{-# 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.MachineLearning.Types.RDSDatabase
-- 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.MachineLearning.Types.RDSDatabase 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

-- | The database details of an Amazon RDS database.
--
-- /See:/ 'newRDSDatabase' smart constructor.
data RDSDatabase = RDSDatabase'
  { -- | The ID of an RDS DB instance.
    RDSDatabase -> Text
instanceIdentifier :: Prelude.Text,
    RDSDatabase -> Text
databaseName :: Prelude.Text
  }
  deriving (RDSDatabase -> RDSDatabase -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RDSDatabase -> RDSDatabase -> Bool
$c/= :: RDSDatabase -> RDSDatabase -> Bool
== :: RDSDatabase -> RDSDatabase -> Bool
$c== :: RDSDatabase -> RDSDatabase -> Bool
Prelude.Eq, ReadPrec [RDSDatabase]
ReadPrec RDSDatabase
Int -> ReadS RDSDatabase
ReadS [RDSDatabase]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RDSDatabase]
$creadListPrec :: ReadPrec [RDSDatabase]
readPrec :: ReadPrec RDSDatabase
$creadPrec :: ReadPrec RDSDatabase
readList :: ReadS [RDSDatabase]
$creadList :: ReadS [RDSDatabase]
readsPrec :: Int -> ReadS RDSDatabase
$creadsPrec :: Int -> ReadS RDSDatabase
Prelude.Read, Int -> RDSDatabase -> ShowS
[RDSDatabase] -> ShowS
RDSDatabase -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RDSDatabase] -> ShowS
$cshowList :: [RDSDatabase] -> ShowS
show :: RDSDatabase -> String
$cshow :: RDSDatabase -> String
showsPrec :: Int -> RDSDatabase -> ShowS
$cshowsPrec :: Int -> RDSDatabase -> ShowS
Prelude.Show, forall x. Rep RDSDatabase x -> RDSDatabase
forall x. RDSDatabase -> Rep RDSDatabase x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RDSDatabase x -> RDSDatabase
$cfrom :: forall x. RDSDatabase -> Rep RDSDatabase x
Prelude.Generic)

-- |
-- Create a value of 'RDSDatabase' 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:
--
-- 'instanceIdentifier', 'rDSDatabase_instanceIdentifier' - The ID of an RDS DB instance.
--
-- 'databaseName', 'rDSDatabase_databaseName' - Undocumented member.
newRDSDatabase ::
  -- | 'instanceIdentifier'
  Prelude.Text ->
  -- | 'databaseName'
  Prelude.Text ->
  RDSDatabase
newRDSDatabase :: Text -> Text -> RDSDatabase
newRDSDatabase Text
pInstanceIdentifier_ Text
pDatabaseName_ =
  RDSDatabase'
    { $sel:instanceIdentifier:RDSDatabase' :: Text
instanceIdentifier =
        Text
pInstanceIdentifier_,
      $sel:databaseName:RDSDatabase' :: Text
databaseName = Text
pDatabaseName_
    }

-- | The ID of an RDS DB instance.
rDSDatabase_instanceIdentifier :: Lens.Lens' RDSDatabase Prelude.Text
rDSDatabase_instanceIdentifier :: Lens' RDSDatabase Text
rDSDatabase_instanceIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RDSDatabase' {Text
instanceIdentifier :: Text
$sel:instanceIdentifier:RDSDatabase' :: RDSDatabase -> Text
instanceIdentifier} -> Text
instanceIdentifier) (\s :: RDSDatabase
s@RDSDatabase' {} Text
a -> RDSDatabase
s {$sel:instanceIdentifier:RDSDatabase' :: Text
instanceIdentifier = Text
a} :: RDSDatabase)

-- | Undocumented member.
rDSDatabase_databaseName :: Lens.Lens' RDSDatabase Prelude.Text
rDSDatabase_databaseName :: Lens' RDSDatabase Text
rDSDatabase_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RDSDatabase' {Text
databaseName :: Text
$sel:databaseName:RDSDatabase' :: RDSDatabase -> Text
databaseName} -> Text
databaseName) (\s :: RDSDatabase
s@RDSDatabase' {} Text
a -> RDSDatabase
s {$sel:databaseName:RDSDatabase' :: Text
databaseName = Text
a} :: RDSDatabase)

instance Data.FromJSON RDSDatabase where
  parseJSON :: Value -> Parser RDSDatabase
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RDSDatabase"
      ( \Object
x ->
          Text -> Text -> RDSDatabase
RDSDatabase'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"InstanceIdentifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DatabaseName")
      )

instance Prelude.Hashable RDSDatabase where
  hashWithSalt :: Int -> RDSDatabase -> Int
hashWithSalt Int
_salt RDSDatabase' {Text
databaseName :: Text
instanceIdentifier :: Text
$sel:databaseName:RDSDatabase' :: RDSDatabase -> Text
$sel:instanceIdentifier:RDSDatabase' :: RDSDatabase -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
databaseName

instance Prelude.NFData RDSDatabase where
  rnf :: RDSDatabase -> ()
rnf RDSDatabase' {Text
databaseName :: Text
instanceIdentifier :: Text
$sel:databaseName:RDSDatabase' :: RDSDatabase -> Text
$sel:instanceIdentifier:RDSDatabase' :: RDSDatabase -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
instanceIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
databaseName

instance Data.ToJSON RDSDatabase where
  toJSON :: RDSDatabase -> Value
toJSON RDSDatabase' {Text
databaseName :: Text
instanceIdentifier :: Text
$sel:databaseName:RDSDatabase' :: RDSDatabase -> Text
$sel:instanceIdentifier:RDSDatabase' :: RDSDatabase -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"InstanceIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
instanceIdentifier),
            forall a. a -> Maybe a
Prelude.Just (Key
"DatabaseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
databaseName)
          ]
      )