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

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

-- | The database credentials to connect to a database on an RDS DB instance.
--
-- /See:/ 'newRDSDatabaseCredentials' smart constructor.
data RDSDatabaseCredentials = RDSDatabaseCredentials'
  { RDSDatabaseCredentials -> Text
username :: Prelude.Text,
    RDSDatabaseCredentials -> Text
password :: Prelude.Text
  }
  deriving (RDSDatabaseCredentials -> RDSDatabaseCredentials -> Bool
(RDSDatabaseCredentials -> RDSDatabaseCredentials -> Bool)
-> (RDSDatabaseCredentials -> RDSDatabaseCredentials -> Bool)
-> Eq RDSDatabaseCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RDSDatabaseCredentials -> RDSDatabaseCredentials -> Bool
$c/= :: RDSDatabaseCredentials -> RDSDatabaseCredentials -> Bool
== :: RDSDatabaseCredentials -> RDSDatabaseCredentials -> Bool
$c== :: RDSDatabaseCredentials -> RDSDatabaseCredentials -> Bool
Prelude.Eq, ReadPrec [RDSDatabaseCredentials]
ReadPrec RDSDatabaseCredentials
Int -> ReadS RDSDatabaseCredentials
ReadS [RDSDatabaseCredentials]
(Int -> ReadS RDSDatabaseCredentials)
-> ReadS [RDSDatabaseCredentials]
-> ReadPrec RDSDatabaseCredentials
-> ReadPrec [RDSDatabaseCredentials]
-> Read RDSDatabaseCredentials
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RDSDatabaseCredentials]
$creadListPrec :: ReadPrec [RDSDatabaseCredentials]
readPrec :: ReadPrec RDSDatabaseCredentials
$creadPrec :: ReadPrec RDSDatabaseCredentials
readList :: ReadS [RDSDatabaseCredentials]
$creadList :: ReadS [RDSDatabaseCredentials]
readsPrec :: Int -> ReadS RDSDatabaseCredentials
$creadsPrec :: Int -> ReadS RDSDatabaseCredentials
Prelude.Read, Int -> RDSDatabaseCredentials -> ShowS
[RDSDatabaseCredentials] -> ShowS
RDSDatabaseCredentials -> String
(Int -> RDSDatabaseCredentials -> ShowS)
-> (RDSDatabaseCredentials -> String)
-> ([RDSDatabaseCredentials] -> ShowS)
-> Show RDSDatabaseCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RDSDatabaseCredentials] -> ShowS
$cshowList :: [RDSDatabaseCredentials] -> ShowS
show :: RDSDatabaseCredentials -> String
$cshow :: RDSDatabaseCredentials -> String
showsPrec :: Int -> RDSDatabaseCredentials -> ShowS
$cshowsPrec :: Int -> RDSDatabaseCredentials -> ShowS
Prelude.Show, (forall x. RDSDatabaseCredentials -> Rep RDSDatabaseCredentials x)
-> (forall x.
    Rep RDSDatabaseCredentials x -> RDSDatabaseCredentials)
-> Generic RDSDatabaseCredentials
forall x. Rep RDSDatabaseCredentials x -> RDSDatabaseCredentials
forall x. RDSDatabaseCredentials -> Rep RDSDatabaseCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RDSDatabaseCredentials x -> RDSDatabaseCredentials
$cfrom :: forall x. RDSDatabaseCredentials -> Rep RDSDatabaseCredentials x
Prelude.Generic)

-- |
-- Create a value of 'RDSDatabaseCredentials' 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:
--
-- 'username', 'rDSDatabaseCredentials_username' - Undocumented member.
--
-- 'password', 'rDSDatabaseCredentials_password' - Undocumented member.
newRDSDatabaseCredentials ::
  -- | 'username'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  RDSDatabaseCredentials
newRDSDatabaseCredentials :: Text -> Text -> RDSDatabaseCredentials
newRDSDatabaseCredentials Text
pUsername_ Text
pPassword_ =
  RDSDatabaseCredentials' :: Text -> Text -> RDSDatabaseCredentials
RDSDatabaseCredentials'
    { $sel:username:RDSDatabaseCredentials' :: Text
username = Text
pUsername_,
      $sel:password:RDSDatabaseCredentials' :: Text
password = Text
pPassword_
    }

-- | Undocumented member.
rDSDatabaseCredentials_username :: Lens.Lens' RDSDatabaseCredentials Prelude.Text
rDSDatabaseCredentials_username :: (Text -> f Text)
-> RDSDatabaseCredentials -> f RDSDatabaseCredentials
rDSDatabaseCredentials_username = (RDSDatabaseCredentials -> Text)
-> (RDSDatabaseCredentials -> Text -> RDSDatabaseCredentials)
-> Lens RDSDatabaseCredentials RDSDatabaseCredentials Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RDSDatabaseCredentials' {Text
username :: Text
$sel:username:RDSDatabaseCredentials' :: RDSDatabaseCredentials -> Text
username} -> Text
username) (\s :: RDSDatabaseCredentials
s@RDSDatabaseCredentials' {} Text
a -> RDSDatabaseCredentials
s {$sel:username:RDSDatabaseCredentials' :: Text
username = Text
a} :: RDSDatabaseCredentials)

-- | Undocumented member.
rDSDatabaseCredentials_password :: Lens.Lens' RDSDatabaseCredentials Prelude.Text
rDSDatabaseCredentials_password :: (Text -> f Text)
-> RDSDatabaseCredentials -> f RDSDatabaseCredentials
rDSDatabaseCredentials_password = (RDSDatabaseCredentials -> Text)
-> (RDSDatabaseCredentials -> Text -> RDSDatabaseCredentials)
-> Lens RDSDatabaseCredentials RDSDatabaseCredentials Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RDSDatabaseCredentials' {Text
password :: Text
$sel:password:RDSDatabaseCredentials' :: RDSDatabaseCredentials -> Text
password} -> Text
password) (\s :: RDSDatabaseCredentials
s@RDSDatabaseCredentials' {} Text
a -> RDSDatabaseCredentials
s {$sel:password:RDSDatabaseCredentials' :: Text
password = Text
a} :: RDSDatabaseCredentials)

instance Prelude.Hashable RDSDatabaseCredentials

instance Prelude.NFData RDSDatabaseCredentials

instance Core.ToJSON RDSDatabaseCredentials where
  toJSON :: RDSDatabaseCredentials -> Value
toJSON RDSDatabaseCredentials' {Text
password :: Text
username :: Text
$sel:password:RDSDatabaseCredentials' :: RDSDatabaseCredentials -> Text
$sel:username:RDSDatabaseCredentials' :: RDSDatabaseCredentials -> 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
"Username" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
username),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Password" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
password)
          ]
      )