{-# 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.OpsWorks.Types.RdsDbInstance
-- 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.OpsWorks.Types.RdsDbInstance 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

-- | Describes an Amazon RDS instance.
--
-- /See:/ 'newRdsDbInstance' smart constructor.
data RdsDbInstance = RdsDbInstance'
  { -- | The instance\'s address.
    RdsDbInstance -> Maybe Text
address :: Prelude.Maybe Prelude.Text,
    -- | The DB instance identifier.
    RdsDbInstance -> Maybe Text
dbInstanceIdentifier :: Prelude.Maybe Prelude.Text,
    -- | AWS OpsWorks Stacks returns @*****FILTERED*****@ instead of the actual
    -- value.
    RdsDbInstance -> Maybe Text
dbPassword :: Prelude.Maybe Prelude.Text,
    -- | The master user name.
    RdsDbInstance -> Maybe Text
dbUser :: Prelude.Maybe Prelude.Text,
    -- | The instance\'s database engine.
    RdsDbInstance -> Maybe Text
engine :: Prelude.Maybe Prelude.Text,
    -- | Set to @true@ if AWS OpsWorks Stacks is unable to discover the Amazon
    -- RDS instance. AWS OpsWorks Stacks attempts to discover the instance only
    -- once. If this value is set to @true@, you must deregister the instance,
    -- and then register it again.
    RdsDbInstance -> Maybe Bool
missingOnRds :: Prelude.Maybe Prelude.Bool,
    -- | The instance\'s ARN.
    RdsDbInstance -> Maybe Text
rdsDbInstanceArn :: Prelude.Maybe Prelude.Text,
    -- | The instance\'s AWS region.
    RdsDbInstance -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The ID of the stack with which the instance is registered.
    RdsDbInstance -> Maybe Text
stackId :: Prelude.Maybe Prelude.Text
  }
  deriving (RdsDbInstance -> RdsDbInstance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RdsDbInstance -> RdsDbInstance -> Bool
$c/= :: RdsDbInstance -> RdsDbInstance -> Bool
== :: RdsDbInstance -> RdsDbInstance -> Bool
$c== :: RdsDbInstance -> RdsDbInstance -> Bool
Prelude.Eq, ReadPrec [RdsDbInstance]
ReadPrec RdsDbInstance
Int -> ReadS RdsDbInstance
ReadS [RdsDbInstance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RdsDbInstance]
$creadListPrec :: ReadPrec [RdsDbInstance]
readPrec :: ReadPrec RdsDbInstance
$creadPrec :: ReadPrec RdsDbInstance
readList :: ReadS [RdsDbInstance]
$creadList :: ReadS [RdsDbInstance]
readsPrec :: Int -> ReadS RdsDbInstance
$creadsPrec :: Int -> ReadS RdsDbInstance
Prelude.Read, Int -> RdsDbInstance -> ShowS
[RdsDbInstance] -> ShowS
RdsDbInstance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RdsDbInstance] -> ShowS
$cshowList :: [RdsDbInstance] -> ShowS
show :: RdsDbInstance -> String
$cshow :: RdsDbInstance -> String
showsPrec :: Int -> RdsDbInstance -> ShowS
$cshowsPrec :: Int -> RdsDbInstance -> ShowS
Prelude.Show, forall x. Rep RdsDbInstance x -> RdsDbInstance
forall x. RdsDbInstance -> Rep RdsDbInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RdsDbInstance x -> RdsDbInstance
$cfrom :: forall x. RdsDbInstance -> Rep RdsDbInstance x
Prelude.Generic)

-- |
-- Create a value of 'RdsDbInstance' 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:
--
-- 'address', 'rdsDbInstance_address' - The instance\'s address.
--
-- 'dbInstanceIdentifier', 'rdsDbInstance_dbInstanceIdentifier' - The DB instance identifier.
--
-- 'dbPassword', 'rdsDbInstance_dbPassword' - AWS OpsWorks Stacks returns @*****FILTERED*****@ instead of the actual
-- value.
--
-- 'dbUser', 'rdsDbInstance_dbUser' - The master user name.
--
-- 'engine', 'rdsDbInstance_engine' - The instance\'s database engine.
--
-- 'missingOnRds', 'rdsDbInstance_missingOnRds' - Set to @true@ if AWS OpsWorks Stacks is unable to discover the Amazon
-- RDS instance. AWS OpsWorks Stacks attempts to discover the instance only
-- once. If this value is set to @true@, you must deregister the instance,
-- and then register it again.
--
-- 'rdsDbInstanceArn', 'rdsDbInstance_rdsDbInstanceArn' - The instance\'s ARN.
--
-- 'region', 'rdsDbInstance_region' - The instance\'s AWS region.
--
-- 'stackId', 'rdsDbInstance_stackId' - The ID of the stack with which the instance is registered.
newRdsDbInstance ::
  RdsDbInstance
newRdsDbInstance :: RdsDbInstance
newRdsDbInstance =
  RdsDbInstance'
    { $sel:address:RdsDbInstance' :: Maybe Text
address = forall a. Maybe a
Prelude.Nothing,
      $sel:dbInstanceIdentifier:RdsDbInstance' :: Maybe Text
dbInstanceIdentifier = forall a. Maybe a
Prelude.Nothing,
      $sel:dbPassword:RdsDbInstance' :: Maybe Text
dbPassword = forall a. Maybe a
Prelude.Nothing,
      $sel:dbUser:RdsDbInstance' :: Maybe Text
dbUser = forall a. Maybe a
Prelude.Nothing,
      $sel:engine:RdsDbInstance' :: Maybe Text
engine = forall a. Maybe a
Prelude.Nothing,
      $sel:missingOnRds:RdsDbInstance' :: Maybe Bool
missingOnRds = forall a. Maybe a
Prelude.Nothing,
      $sel:rdsDbInstanceArn:RdsDbInstance' :: Maybe Text
rdsDbInstanceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:region:RdsDbInstance' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing,
      $sel:stackId:RdsDbInstance' :: Maybe Text
stackId = forall a. Maybe a
Prelude.Nothing
    }

-- | The instance\'s address.
rdsDbInstance_address :: Lens.Lens' RdsDbInstance (Prelude.Maybe Prelude.Text)
rdsDbInstance_address :: Lens' RdsDbInstance (Maybe Text)
rdsDbInstance_address = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsDbInstance' {Maybe Text
address :: Maybe Text
$sel:address:RdsDbInstance' :: RdsDbInstance -> Maybe Text
address} -> Maybe Text
address) (\s :: RdsDbInstance
s@RdsDbInstance' {} Maybe Text
a -> RdsDbInstance
s {$sel:address:RdsDbInstance' :: Maybe Text
address = Maybe Text
a} :: RdsDbInstance)

-- | The DB instance identifier.
rdsDbInstance_dbInstanceIdentifier :: Lens.Lens' RdsDbInstance (Prelude.Maybe Prelude.Text)
rdsDbInstance_dbInstanceIdentifier :: Lens' RdsDbInstance (Maybe Text)
rdsDbInstance_dbInstanceIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsDbInstance' {Maybe Text
dbInstanceIdentifier :: Maybe Text
$sel:dbInstanceIdentifier:RdsDbInstance' :: RdsDbInstance -> Maybe Text
dbInstanceIdentifier} -> Maybe Text
dbInstanceIdentifier) (\s :: RdsDbInstance
s@RdsDbInstance' {} Maybe Text
a -> RdsDbInstance
s {$sel:dbInstanceIdentifier:RdsDbInstance' :: Maybe Text
dbInstanceIdentifier = Maybe Text
a} :: RdsDbInstance)

-- | AWS OpsWorks Stacks returns @*****FILTERED*****@ instead of the actual
-- value.
rdsDbInstance_dbPassword :: Lens.Lens' RdsDbInstance (Prelude.Maybe Prelude.Text)
rdsDbInstance_dbPassword :: Lens' RdsDbInstance (Maybe Text)
rdsDbInstance_dbPassword = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsDbInstance' {Maybe Text
dbPassword :: Maybe Text
$sel:dbPassword:RdsDbInstance' :: RdsDbInstance -> Maybe Text
dbPassword} -> Maybe Text
dbPassword) (\s :: RdsDbInstance
s@RdsDbInstance' {} Maybe Text
a -> RdsDbInstance
s {$sel:dbPassword:RdsDbInstance' :: Maybe Text
dbPassword = Maybe Text
a} :: RdsDbInstance)

-- | The master user name.
rdsDbInstance_dbUser :: Lens.Lens' RdsDbInstance (Prelude.Maybe Prelude.Text)
rdsDbInstance_dbUser :: Lens' RdsDbInstance (Maybe Text)
rdsDbInstance_dbUser = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsDbInstance' {Maybe Text
dbUser :: Maybe Text
$sel:dbUser:RdsDbInstance' :: RdsDbInstance -> Maybe Text
dbUser} -> Maybe Text
dbUser) (\s :: RdsDbInstance
s@RdsDbInstance' {} Maybe Text
a -> RdsDbInstance
s {$sel:dbUser:RdsDbInstance' :: Maybe Text
dbUser = Maybe Text
a} :: RdsDbInstance)

-- | The instance\'s database engine.
rdsDbInstance_engine :: Lens.Lens' RdsDbInstance (Prelude.Maybe Prelude.Text)
rdsDbInstance_engine :: Lens' RdsDbInstance (Maybe Text)
rdsDbInstance_engine = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsDbInstance' {Maybe Text
engine :: Maybe Text
$sel:engine:RdsDbInstance' :: RdsDbInstance -> Maybe Text
engine} -> Maybe Text
engine) (\s :: RdsDbInstance
s@RdsDbInstance' {} Maybe Text
a -> RdsDbInstance
s {$sel:engine:RdsDbInstance' :: Maybe Text
engine = Maybe Text
a} :: RdsDbInstance)

-- | Set to @true@ if AWS OpsWorks Stacks is unable to discover the Amazon
-- RDS instance. AWS OpsWorks Stacks attempts to discover the instance only
-- once. If this value is set to @true@, you must deregister the instance,
-- and then register it again.
rdsDbInstance_missingOnRds :: Lens.Lens' RdsDbInstance (Prelude.Maybe Prelude.Bool)
rdsDbInstance_missingOnRds :: Lens' RdsDbInstance (Maybe Bool)
rdsDbInstance_missingOnRds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsDbInstance' {Maybe Bool
missingOnRds :: Maybe Bool
$sel:missingOnRds:RdsDbInstance' :: RdsDbInstance -> Maybe Bool
missingOnRds} -> Maybe Bool
missingOnRds) (\s :: RdsDbInstance
s@RdsDbInstance' {} Maybe Bool
a -> RdsDbInstance
s {$sel:missingOnRds:RdsDbInstance' :: Maybe Bool
missingOnRds = Maybe Bool
a} :: RdsDbInstance)

-- | The instance\'s ARN.
rdsDbInstance_rdsDbInstanceArn :: Lens.Lens' RdsDbInstance (Prelude.Maybe Prelude.Text)
rdsDbInstance_rdsDbInstanceArn :: Lens' RdsDbInstance (Maybe Text)
rdsDbInstance_rdsDbInstanceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsDbInstance' {Maybe Text
rdsDbInstanceArn :: Maybe Text
$sel:rdsDbInstanceArn:RdsDbInstance' :: RdsDbInstance -> Maybe Text
rdsDbInstanceArn} -> Maybe Text
rdsDbInstanceArn) (\s :: RdsDbInstance
s@RdsDbInstance' {} Maybe Text
a -> RdsDbInstance
s {$sel:rdsDbInstanceArn:RdsDbInstance' :: Maybe Text
rdsDbInstanceArn = Maybe Text
a} :: RdsDbInstance)

-- | The instance\'s AWS region.
rdsDbInstance_region :: Lens.Lens' RdsDbInstance (Prelude.Maybe Prelude.Text)
rdsDbInstance_region :: Lens' RdsDbInstance (Maybe Text)
rdsDbInstance_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsDbInstance' {Maybe Text
region :: Maybe Text
$sel:region:RdsDbInstance' :: RdsDbInstance -> Maybe Text
region} -> Maybe Text
region) (\s :: RdsDbInstance
s@RdsDbInstance' {} Maybe Text
a -> RdsDbInstance
s {$sel:region:RdsDbInstance' :: Maybe Text
region = Maybe Text
a} :: RdsDbInstance)

-- | The ID of the stack with which the instance is registered.
rdsDbInstance_stackId :: Lens.Lens' RdsDbInstance (Prelude.Maybe Prelude.Text)
rdsDbInstance_stackId :: Lens' RdsDbInstance (Maybe Text)
rdsDbInstance_stackId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RdsDbInstance' {Maybe Text
stackId :: Maybe Text
$sel:stackId:RdsDbInstance' :: RdsDbInstance -> Maybe Text
stackId} -> Maybe Text
stackId) (\s :: RdsDbInstance
s@RdsDbInstance' {} Maybe Text
a -> RdsDbInstance
s {$sel:stackId:RdsDbInstance' :: Maybe Text
stackId = Maybe Text
a} :: RdsDbInstance)

instance Data.FromJSON RdsDbInstance where
  parseJSON :: Value -> Parser RdsDbInstance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RdsDbInstance"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RdsDbInstance
RdsDbInstance'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Address")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DbInstanceIdentifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DbPassword")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DbUser")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Engine")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MissingOnRds")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RdsDbInstanceArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Region")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StackId")
      )

instance Prelude.Hashable RdsDbInstance where
  hashWithSalt :: Int -> RdsDbInstance -> Int
hashWithSalt Int
_salt RdsDbInstance' {Maybe Bool
Maybe Text
stackId :: Maybe Text
region :: Maybe Text
rdsDbInstanceArn :: Maybe Text
missingOnRds :: Maybe Bool
engine :: Maybe Text
dbUser :: Maybe Text
dbPassword :: Maybe Text
dbInstanceIdentifier :: Maybe Text
address :: Maybe Text
$sel:stackId:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:region:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:rdsDbInstanceArn:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:missingOnRds:RdsDbInstance' :: RdsDbInstance -> Maybe Bool
$sel:engine:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:dbUser:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:dbPassword:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:dbInstanceIdentifier:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:address:RdsDbInstance' :: RdsDbInstance -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
address
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dbInstanceIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dbPassword
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dbUser
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
engine
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
missingOnRds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
rdsDbInstanceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stackId

instance Prelude.NFData RdsDbInstance where
  rnf :: RdsDbInstance -> ()
rnf RdsDbInstance' {Maybe Bool
Maybe Text
stackId :: Maybe Text
region :: Maybe Text
rdsDbInstanceArn :: Maybe Text
missingOnRds :: Maybe Bool
engine :: Maybe Text
dbUser :: Maybe Text
dbPassword :: Maybe Text
dbInstanceIdentifier :: Maybe Text
address :: Maybe Text
$sel:stackId:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:region:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:rdsDbInstanceArn:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:missingOnRds:RdsDbInstance' :: RdsDbInstance -> Maybe Bool
$sel:engine:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:dbUser:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:dbPassword:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:dbInstanceIdentifier:RdsDbInstance' :: RdsDbInstance -> Maybe Text
$sel:address:RdsDbInstance' :: RdsDbInstance -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
address
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dbInstanceIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dbPassword
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dbUser
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
engine
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
missingOnRds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
rdsDbInstanceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stackId