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

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

-- | Describes the database credentials for connecting to a database on an
-- Amazon Redshift cluster.
--
-- /See:/ 'newRedshiftDatabaseCredentials' smart constructor.
data RedshiftDatabaseCredentials = RedshiftDatabaseCredentials'
  { RedshiftDatabaseCredentials -> Text
username :: Prelude.Text,
    RedshiftDatabaseCredentials -> Text
password :: Prelude.Text
  }
  deriving (RedshiftDatabaseCredentials -> RedshiftDatabaseCredentials -> Bool
(RedshiftDatabaseCredentials
 -> RedshiftDatabaseCredentials -> Bool)
-> (RedshiftDatabaseCredentials
    -> RedshiftDatabaseCredentials -> Bool)
-> Eq RedshiftDatabaseCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RedshiftDatabaseCredentials -> RedshiftDatabaseCredentials -> Bool
$c/= :: RedshiftDatabaseCredentials -> RedshiftDatabaseCredentials -> Bool
== :: RedshiftDatabaseCredentials -> RedshiftDatabaseCredentials -> Bool
$c== :: RedshiftDatabaseCredentials -> RedshiftDatabaseCredentials -> Bool
Prelude.Eq, ReadPrec [RedshiftDatabaseCredentials]
ReadPrec RedshiftDatabaseCredentials
Int -> ReadS RedshiftDatabaseCredentials
ReadS [RedshiftDatabaseCredentials]
(Int -> ReadS RedshiftDatabaseCredentials)
-> ReadS [RedshiftDatabaseCredentials]
-> ReadPrec RedshiftDatabaseCredentials
-> ReadPrec [RedshiftDatabaseCredentials]
-> Read RedshiftDatabaseCredentials
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RedshiftDatabaseCredentials]
$creadListPrec :: ReadPrec [RedshiftDatabaseCredentials]
readPrec :: ReadPrec RedshiftDatabaseCredentials
$creadPrec :: ReadPrec RedshiftDatabaseCredentials
readList :: ReadS [RedshiftDatabaseCredentials]
$creadList :: ReadS [RedshiftDatabaseCredentials]
readsPrec :: Int -> ReadS RedshiftDatabaseCredentials
$creadsPrec :: Int -> ReadS RedshiftDatabaseCredentials
Prelude.Read, Int -> RedshiftDatabaseCredentials -> ShowS
[RedshiftDatabaseCredentials] -> ShowS
RedshiftDatabaseCredentials -> String
(Int -> RedshiftDatabaseCredentials -> ShowS)
-> (RedshiftDatabaseCredentials -> String)
-> ([RedshiftDatabaseCredentials] -> ShowS)
-> Show RedshiftDatabaseCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RedshiftDatabaseCredentials] -> ShowS
$cshowList :: [RedshiftDatabaseCredentials] -> ShowS
show :: RedshiftDatabaseCredentials -> String
$cshow :: RedshiftDatabaseCredentials -> String
showsPrec :: Int -> RedshiftDatabaseCredentials -> ShowS
$cshowsPrec :: Int -> RedshiftDatabaseCredentials -> ShowS
Prelude.Show, (forall x.
 RedshiftDatabaseCredentials -> Rep RedshiftDatabaseCredentials x)
-> (forall x.
    Rep RedshiftDatabaseCredentials x -> RedshiftDatabaseCredentials)
-> Generic RedshiftDatabaseCredentials
forall x.
Rep RedshiftDatabaseCredentials x -> RedshiftDatabaseCredentials
forall x.
RedshiftDatabaseCredentials -> Rep RedshiftDatabaseCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RedshiftDatabaseCredentials x -> RedshiftDatabaseCredentials
$cfrom :: forall x.
RedshiftDatabaseCredentials -> Rep RedshiftDatabaseCredentials x
Prelude.Generic)

-- |
-- Create a value of 'RedshiftDatabaseCredentials' 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', 'redshiftDatabaseCredentials_username' - Undocumented member.
--
-- 'password', 'redshiftDatabaseCredentials_password' - Undocumented member.
newRedshiftDatabaseCredentials ::
  -- | 'username'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  RedshiftDatabaseCredentials
newRedshiftDatabaseCredentials :: Text -> Text -> RedshiftDatabaseCredentials
newRedshiftDatabaseCredentials Text
pUsername_ Text
pPassword_ =
  RedshiftDatabaseCredentials' :: Text -> Text -> RedshiftDatabaseCredentials
RedshiftDatabaseCredentials'
    { $sel:username:RedshiftDatabaseCredentials' :: Text
username = Text
pUsername_,
      $sel:password:RedshiftDatabaseCredentials' :: Text
password = Text
pPassword_
    }

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

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

instance Prelude.Hashable RedshiftDatabaseCredentials

instance Prelude.NFData RedshiftDatabaseCredentials

instance Core.ToJSON RedshiftDatabaseCredentials where
  toJSON :: RedshiftDatabaseCredentials -> Value
toJSON RedshiftDatabaseCredentials' {Text
password :: Text
username :: Text
$sel:password:RedshiftDatabaseCredentials' :: RedshiftDatabaseCredentials -> Text
$sel:username:RedshiftDatabaseCredentials' :: RedshiftDatabaseCredentials -> 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)
          ]
      )