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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(RDSDatabase -> RDSDatabase -> Bool)
-> (RDSDatabase -> RDSDatabase -> Bool) -> Eq RDSDatabase
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]
(Int -> ReadS RDSDatabase)
-> ReadS [RDSDatabase]
-> ReadPrec RDSDatabase
-> ReadPrec [RDSDatabase]
-> Read 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
(Int -> RDSDatabase -> ShowS)
-> (RDSDatabase -> String)
-> ([RDSDatabase] -> ShowS)
-> Show RDSDatabase
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. RDSDatabase -> Rep RDSDatabase x)
-> (forall x. Rep RDSDatabase x -> RDSDatabase)
-> Generic RDSDatabase
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' :: Text -> Text -> RDSDatabase
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 :: (Text -> f Text) -> RDSDatabase -> f RDSDatabase
rDSDatabase_instanceIdentifier = (RDSDatabase -> Text)
-> (RDSDatabase -> Text -> RDSDatabase)
-> Lens RDSDatabase RDSDatabase Text Text
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 :: (Text -> f Text) -> RDSDatabase -> f RDSDatabase
rDSDatabase_databaseName = (RDSDatabase -> Text)
-> (RDSDatabase -> Text -> RDSDatabase)
-> Lens RDSDatabase RDSDatabase Text Text
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 Core.FromJSON RDSDatabase where
  parseJSON :: Value -> Parser RDSDatabase
parseJSON =
    String
-> (Object -> Parser RDSDatabase) -> Value -> Parser RDSDatabase
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RDSDatabase"
      ( \Object
x ->
          Text -> Text -> RDSDatabase
RDSDatabase'
            (Text -> Text -> RDSDatabase)
-> Parser Text -> Parser (Text -> RDSDatabase)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InstanceIdentifier")
            Parser (Text -> RDSDatabase) -> Parser Text -> Parser RDSDatabase
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DatabaseName")
      )

instance Prelude.Hashable RDSDatabase

instance Prelude.NFData RDSDatabase

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"InstanceIdentifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceIdentifier),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DatabaseName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
databaseName)
          ]
      )