{-# 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.AwsRdsDbClusterMember
-- 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.AwsRdsDbClusterMember where

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

-- | Information about an instance in the DB cluster.
--
-- /See:/ 'newAwsRdsDbClusterMember' smart constructor.
data AwsRdsDbClusterMember = AwsRdsDbClusterMember'
  { -- | Specifies the order in which an Aurora replica is promoted to the
    -- primary instance when the existing primary instance fails.
    AwsRdsDbClusterMember -> Maybe Int
promotionTier :: Prelude.Maybe Prelude.Int,
    -- | The instance identifier for this member of the DB cluster.
    AwsRdsDbClusterMember -> Maybe Text
dbInstanceIdentifier :: Prelude.Maybe Prelude.Text,
    -- | Whether the cluster member is the primary instance for the DB cluster.
    AwsRdsDbClusterMember -> Maybe Bool
isClusterWriter :: Prelude.Maybe Prelude.Bool,
    -- | The status of the DB cluster parameter group for this member of the DB
    -- cluster.
    AwsRdsDbClusterMember -> Maybe Text
dbClusterParameterGroupStatus :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsRdsDbClusterMember -> AwsRdsDbClusterMember -> Bool
(AwsRdsDbClusterMember -> AwsRdsDbClusterMember -> Bool)
-> (AwsRdsDbClusterMember -> AwsRdsDbClusterMember -> Bool)
-> Eq AwsRdsDbClusterMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsRdsDbClusterMember -> AwsRdsDbClusterMember -> Bool
$c/= :: AwsRdsDbClusterMember -> AwsRdsDbClusterMember -> Bool
== :: AwsRdsDbClusterMember -> AwsRdsDbClusterMember -> Bool
$c== :: AwsRdsDbClusterMember -> AwsRdsDbClusterMember -> Bool
Prelude.Eq, ReadPrec [AwsRdsDbClusterMember]
ReadPrec AwsRdsDbClusterMember
Int -> ReadS AwsRdsDbClusterMember
ReadS [AwsRdsDbClusterMember]
(Int -> ReadS AwsRdsDbClusterMember)
-> ReadS [AwsRdsDbClusterMember]
-> ReadPrec AwsRdsDbClusterMember
-> ReadPrec [AwsRdsDbClusterMember]
-> Read AwsRdsDbClusterMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsRdsDbClusterMember]
$creadListPrec :: ReadPrec [AwsRdsDbClusterMember]
readPrec :: ReadPrec AwsRdsDbClusterMember
$creadPrec :: ReadPrec AwsRdsDbClusterMember
readList :: ReadS [AwsRdsDbClusterMember]
$creadList :: ReadS [AwsRdsDbClusterMember]
readsPrec :: Int -> ReadS AwsRdsDbClusterMember
$creadsPrec :: Int -> ReadS AwsRdsDbClusterMember
Prelude.Read, Int -> AwsRdsDbClusterMember -> ShowS
[AwsRdsDbClusterMember] -> ShowS
AwsRdsDbClusterMember -> String
(Int -> AwsRdsDbClusterMember -> ShowS)
-> (AwsRdsDbClusterMember -> String)
-> ([AwsRdsDbClusterMember] -> ShowS)
-> Show AwsRdsDbClusterMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsRdsDbClusterMember] -> ShowS
$cshowList :: [AwsRdsDbClusterMember] -> ShowS
show :: AwsRdsDbClusterMember -> String
$cshow :: AwsRdsDbClusterMember -> String
showsPrec :: Int -> AwsRdsDbClusterMember -> ShowS
$cshowsPrec :: Int -> AwsRdsDbClusterMember -> ShowS
Prelude.Show, (forall x. AwsRdsDbClusterMember -> Rep AwsRdsDbClusterMember x)
-> (forall x. Rep AwsRdsDbClusterMember x -> AwsRdsDbClusterMember)
-> Generic AwsRdsDbClusterMember
forall x. Rep AwsRdsDbClusterMember x -> AwsRdsDbClusterMember
forall x. AwsRdsDbClusterMember -> Rep AwsRdsDbClusterMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsRdsDbClusterMember x -> AwsRdsDbClusterMember
$cfrom :: forall x. AwsRdsDbClusterMember -> Rep AwsRdsDbClusterMember x
Prelude.Generic)

-- |
-- Create a value of 'AwsRdsDbClusterMember' 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:
--
-- 'promotionTier', 'awsRdsDbClusterMember_promotionTier' - Specifies the order in which an Aurora replica is promoted to the
-- primary instance when the existing primary instance fails.
--
-- 'dbInstanceIdentifier', 'awsRdsDbClusterMember_dbInstanceIdentifier' - The instance identifier for this member of the DB cluster.
--
-- 'isClusterWriter', 'awsRdsDbClusterMember_isClusterWriter' - Whether the cluster member is the primary instance for the DB cluster.
--
-- 'dbClusterParameterGroupStatus', 'awsRdsDbClusterMember_dbClusterParameterGroupStatus' - The status of the DB cluster parameter group for this member of the DB
-- cluster.
newAwsRdsDbClusterMember ::
  AwsRdsDbClusterMember
newAwsRdsDbClusterMember :: AwsRdsDbClusterMember
newAwsRdsDbClusterMember =
  AwsRdsDbClusterMember' :: Maybe Int
-> Maybe Text -> Maybe Bool -> Maybe Text -> AwsRdsDbClusterMember
AwsRdsDbClusterMember'
    { $sel:promotionTier:AwsRdsDbClusterMember' :: Maybe Int
promotionTier =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:dbInstanceIdentifier:AwsRdsDbClusterMember' :: Maybe Text
dbInstanceIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isClusterWriter:AwsRdsDbClusterMember' :: Maybe Bool
isClusterWriter = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:dbClusterParameterGroupStatus:AwsRdsDbClusterMember' :: Maybe Text
dbClusterParameterGroupStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the order in which an Aurora replica is promoted to the
-- primary instance when the existing primary instance fails.
awsRdsDbClusterMember_promotionTier :: Lens.Lens' AwsRdsDbClusterMember (Prelude.Maybe Prelude.Int)
awsRdsDbClusterMember_promotionTier :: (Maybe Int -> f (Maybe Int))
-> AwsRdsDbClusterMember -> f AwsRdsDbClusterMember
awsRdsDbClusterMember_promotionTier = (AwsRdsDbClusterMember -> Maybe Int)
-> (AwsRdsDbClusterMember -> Maybe Int -> AwsRdsDbClusterMember)
-> Lens
     AwsRdsDbClusterMember AwsRdsDbClusterMember (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbClusterMember' {Maybe Int
promotionTier :: Maybe Int
$sel:promotionTier:AwsRdsDbClusterMember' :: AwsRdsDbClusterMember -> Maybe Int
promotionTier} -> Maybe Int
promotionTier) (\s :: AwsRdsDbClusterMember
s@AwsRdsDbClusterMember' {} Maybe Int
a -> AwsRdsDbClusterMember
s {$sel:promotionTier:AwsRdsDbClusterMember' :: Maybe Int
promotionTier = Maybe Int
a} :: AwsRdsDbClusterMember)

-- | The instance identifier for this member of the DB cluster.
awsRdsDbClusterMember_dbInstanceIdentifier :: Lens.Lens' AwsRdsDbClusterMember (Prelude.Maybe Prelude.Text)
awsRdsDbClusterMember_dbInstanceIdentifier :: (Maybe Text -> f (Maybe Text))
-> AwsRdsDbClusterMember -> f AwsRdsDbClusterMember
awsRdsDbClusterMember_dbInstanceIdentifier = (AwsRdsDbClusterMember -> Maybe Text)
-> (AwsRdsDbClusterMember -> Maybe Text -> AwsRdsDbClusterMember)
-> Lens
     AwsRdsDbClusterMember
     AwsRdsDbClusterMember
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbClusterMember' {Maybe Text
dbInstanceIdentifier :: Maybe Text
$sel:dbInstanceIdentifier:AwsRdsDbClusterMember' :: AwsRdsDbClusterMember -> Maybe Text
dbInstanceIdentifier} -> Maybe Text
dbInstanceIdentifier) (\s :: AwsRdsDbClusterMember
s@AwsRdsDbClusterMember' {} Maybe Text
a -> AwsRdsDbClusterMember
s {$sel:dbInstanceIdentifier:AwsRdsDbClusterMember' :: Maybe Text
dbInstanceIdentifier = Maybe Text
a} :: AwsRdsDbClusterMember)

-- | Whether the cluster member is the primary instance for the DB cluster.
awsRdsDbClusterMember_isClusterWriter :: Lens.Lens' AwsRdsDbClusterMember (Prelude.Maybe Prelude.Bool)
awsRdsDbClusterMember_isClusterWriter :: (Maybe Bool -> f (Maybe Bool))
-> AwsRdsDbClusterMember -> f AwsRdsDbClusterMember
awsRdsDbClusterMember_isClusterWriter = (AwsRdsDbClusterMember -> Maybe Bool)
-> (AwsRdsDbClusterMember -> Maybe Bool -> AwsRdsDbClusterMember)
-> Lens
     AwsRdsDbClusterMember
     AwsRdsDbClusterMember
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbClusterMember' {Maybe Bool
isClusterWriter :: Maybe Bool
$sel:isClusterWriter:AwsRdsDbClusterMember' :: AwsRdsDbClusterMember -> Maybe Bool
isClusterWriter} -> Maybe Bool
isClusterWriter) (\s :: AwsRdsDbClusterMember
s@AwsRdsDbClusterMember' {} Maybe Bool
a -> AwsRdsDbClusterMember
s {$sel:isClusterWriter:AwsRdsDbClusterMember' :: Maybe Bool
isClusterWriter = Maybe Bool
a} :: AwsRdsDbClusterMember)

-- | The status of the DB cluster parameter group for this member of the DB
-- cluster.
awsRdsDbClusterMember_dbClusterParameterGroupStatus :: Lens.Lens' AwsRdsDbClusterMember (Prelude.Maybe Prelude.Text)
awsRdsDbClusterMember_dbClusterParameterGroupStatus :: (Maybe Text -> f (Maybe Text))
-> AwsRdsDbClusterMember -> f AwsRdsDbClusterMember
awsRdsDbClusterMember_dbClusterParameterGroupStatus = (AwsRdsDbClusterMember -> Maybe Text)
-> (AwsRdsDbClusterMember -> Maybe Text -> AwsRdsDbClusterMember)
-> Lens
     AwsRdsDbClusterMember
     AwsRdsDbClusterMember
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbClusterMember' {Maybe Text
dbClusterParameterGroupStatus :: Maybe Text
$sel:dbClusterParameterGroupStatus:AwsRdsDbClusterMember' :: AwsRdsDbClusterMember -> Maybe Text
dbClusterParameterGroupStatus} -> Maybe Text
dbClusterParameterGroupStatus) (\s :: AwsRdsDbClusterMember
s@AwsRdsDbClusterMember' {} Maybe Text
a -> AwsRdsDbClusterMember
s {$sel:dbClusterParameterGroupStatus:AwsRdsDbClusterMember' :: Maybe Text
dbClusterParameterGroupStatus = Maybe Text
a} :: AwsRdsDbClusterMember)

instance Core.FromJSON AwsRdsDbClusterMember where
  parseJSON :: Value -> Parser AwsRdsDbClusterMember
parseJSON =
    String
-> (Object -> Parser AwsRdsDbClusterMember)
-> Value
-> Parser AwsRdsDbClusterMember
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsRdsDbClusterMember"
      ( \Object
x ->
          Maybe Int
-> Maybe Text -> Maybe Bool -> Maybe Text -> AwsRdsDbClusterMember
AwsRdsDbClusterMember'
            (Maybe Int
 -> Maybe Text -> Maybe Bool -> Maybe Text -> AwsRdsDbClusterMember)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text -> Maybe Bool -> Maybe Text -> AwsRdsDbClusterMember)
forall (f :: * -> *) a b. Functor 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
"PromotionTier")
            Parser
  (Maybe Text -> Maybe Bool -> Maybe Text -> AwsRdsDbClusterMember)
-> Parser (Maybe Text)
-> Parser (Maybe Bool -> Maybe Text -> AwsRdsDbClusterMember)
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
"DbInstanceIdentifier")
            Parser (Maybe Bool -> Maybe Text -> AwsRdsDbClusterMember)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> AwsRdsDbClusterMember)
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
"IsClusterWriter")
            Parser (Maybe Text -> AwsRdsDbClusterMember)
-> Parser (Maybe Text) -> Parser AwsRdsDbClusterMember
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
"DbClusterParameterGroupStatus")
      )

instance Prelude.Hashable AwsRdsDbClusterMember

instance Prelude.NFData AwsRdsDbClusterMember

instance Core.ToJSON AwsRdsDbClusterMember where
  toJSON :: AwsRdsDbClusterMember -> Value
toJSON AwsRdsDbClusterMember' {Maybe Bool
Maybe Int
Maybe Text
dbClusterParameterGroupStatus :: Maybe Text
isClusterWriter :: Maybe Bool
dbInstanceIdentifier :: Maybe Text
promotionTier :: Maybe Int
$sel:dbClusterParameterGroupStatus:AwsRdsDbClusterMember' :: AwsRdsDbClusterMember -> Maybe Text
$sel:isClusterWriter:AwsRdsDbClusterMember' :: AwsRdsDbClusterMember -> Maybe Bool
$sel:dbInstanceIdentifier:AwsRdsDbClusterMember' :: AwsRdsDbClusterMember -> Maybe Text
$sel:promotionTier:AwsRdsDbClusterMember' :: AwsRdsDbClusterMember -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PromotionTier" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
promotionTier,
            (Text
"DbInstanceIdentifier" 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
dbInstanceIdentifier,
            (Text
"IsClusterWriter" 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
isClusterWriter,
            (Text
"DbClusterParameterGroupStatus" 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
dbClusterParameterGroupStatus
          ]
      )