{-# 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.AppFlow.Types.RedshiftConnectorProfileCredentials
-- 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.AppFlow.Types.RedshiftConnectorProfileCredentials where

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

-- | The connector-specific profile credentials required when using Amazon
-- Redshift.
--
-- /See:/ 'newRedshiftConnectorProfileCredentials' smart constructor.
data RedshiftConnectorProfileCredentials = RedshiftConnectorProfileCredentials'
  { -- | The name of the user.
    RedshiftConnectorProfileCredentials -> Text
username :: Prelude.Text,
    -- | The password that corresponds to the user name.
    RedshiftConnectorProfileCredentials -> Sensitive Text
password :: Core.Sensitive Prelude.Text
  }
  deriving (RedshiftConnectorProfileCredentials
-> RedshiftConnectorProfileCredentials -> Bool
(RedshiftConnectorProfileCredentials
 -> RedshiftConnectorProfileCredentials -> Bool)
-> (RedshiftConnectorProfileCredentials
    -> RedshiftConnectorProfileCredentials -> Bool)
-> Eq RedshiftConnectorProfileCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RedshiftConnectorProfileCredentials
-> RedshiftConnectorProfileCredentials -> Bool
$c/= :: RedshiftConnectorProfileCredentials
-> RedshiftConnectorProfileCredentials -> Bool
== :: RedshiftConnectorProfileCredentials
-> RedshiftConnectorProfileCredentials -> Bool
$c== :: RedshiftConnectorProfileCredentials
-> RedshiftConnectorProfileCredentials -> Bool
Prelude.Eq, Int -> RedshiftConnectorProfileCredentials -> ShowS
[RedshiftConnectorProfileCredentials] -> ShowS
RedshiftConnectorProfileCredentials -> String
(Int -> RedshiftConnectorProfileCredentials -> ShowS)
-> (RedshiftConnectorProfileCredentials -> String)
-> ([RedshiftConnectorProfileCredentials] -> ShowS)
-> Show RedshiftConnectorProfileCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RedshiftConnectorProfileCredentials] -> ShowS
$cshowList :: [RedshiftConnectorProfileCredentials] -> ShowS
show :: RedshiftConnectorProfileCredentials -> String
$cshow :: RedshiftConnectorProfileCredentials -> String
showsPrec :: Int -> RedshiftConnectorProfileCredentials -> ShowS
$cshowsPrec :: Int -> RedshiftConnectorProfileCredentials -> ShowS
Prelude.Show, (forall x.
 RedshiftConnectorProfileCredentials
 -> Rep RedshiftConnectorProfileCredentials x)
-> (forall x.
    Rep RedshiftConnectorProfileCredentials x
    -> RedshiftConnectorProfileCredentials)
-> Generic RedshiftConnectorProfileCredentials
forall x.
Rep RedshiftConnectorProfileCredentials x
-> RedshiftConnectorProfileCredentials
forall x.
RedshiftConnectorProfileCredentials
-> Rep RedshiftConnectorProfileCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RedshiftConnectorProfileCredentials x
-> RedshiftConnectorProfileCredentials
$cfrom :: forall x.
RedshiftConnectorProfileCredentials
-> Rep RedshiftConnectorProfileCredentials x
Prelude.Generic)

-- |
-- Create a value of 'RedshiftConnectorProfileCredentials' 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', 'redshiftConnectorProfileCredentials_username' - The name of the user.
--
-- 'password', 'redshiftConnectorProfileCredentials_password' - The password that corresponds to the user name.
newRedshiftConnectorProfileCredentials ::
  -- | 'username'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  RedshiftConnectorProfileCredentials
newRedshiftConnectorProfileCredentials :: Text -> Text -> RedshiftConnectorProfileCredentials
newRedshiftConnectorProfileCredentials
  Text
pUsername_
  Text
pPassword_ =
    RedshiftConnectorProfileCredentials' :: Text -> Sensitive Text -> RedshiftConnectorProfileCredentials
RedshiftConnectorProfileCredentials'
      { $sel:username:RedshiftConnectorProfileCredentials' :: Text
username =
          Text
pUsername_,
        $sel:password:RedshiftConnectorProfileCredentials' :: Sensitive Text
password =
          Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pPassword_
      }

-- | The name of the user.
redshiftConnectorProfileCredentials_username :: Lens.Lens' RedshiftConnectorProfileCredentials Prelude.Text
redshiftConnectorProfileCredentials_username :: (Text -> f Text)
-> RedshiftConnectorProfileCredentials
-> f RedshiftConnectorProfileCredentials
redshiftConnectorProfileCredentials_username = (RedshiftConnectorProfileCredentials -> Text)
-> (RedshiftConnectorProfileCredentials
    -> Text -> RedshiftConnectorProfileCredentials)
-> Lens
     RedshiftConnectorProfileCredentials
     RedshiftConnectorProfileCredentials
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedshiftConnectorProfileCredentials' {Text
username :: Text
$sel:username:RedshiftConnectorProfileCredentials' :: RedshiftConnectorProfileCredentials -> Text
username} -> Text
username) (\s :: RedshiftConnectorProfileCredentials
s@RedshiftConnectorProfileCredentials' {} Text
a -> RedshiftConnectorProfileCredentials
s {$sel:username:RedshiftConnectorProfileCredentials' :: Text
username = Text
a} :: RedshiftConnectorProfileCredentials)

-- | The password that corresponds to the user name.
redshiftConnectorProfileCredentials_password :: Lens.Lens' RedshiftConnectorProfileCredentials Prelude.Text
redshiftConnectorProfileCredentials_password :: (Text -> f Text)
-> RedshiftConnectorProfileCredentials
-> f RedshiftConnectorProfileCredentials
redshiftConnectorProfileCredentials_password = (RedshiftConnectorProfileCredentials -> Sensitive Text)
-> (RedshiftConnectorProfileCredentials
    -> Sensitive Text -> RedshiftConnectorProfileCredentials)
-> Lens
     RedshiftConnectorProfileCredentials
     RedshiftConnectorProfileCredentials
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedshiftConnectorProfileCredentials' {Sensitive Text
password :: Sensitive Text
$sel:password:RedshiftConnectorProfileCredentials' :: RedshiftConnectorProfileCredentials -> Sensitive Text
password} -> Sensitive Text
password) (\s :: RedshiftConnectorProfileCredentials
s@RedshiftConnectorProfileCredentials' {} Sensitive Text
a -> RedshiftConnectorProfileCredentials
s {$sel:password:RedshiftConnectorProfileCredentials' :: Sensitive Text
password = Sensitive Text
a} :: RedshiftConnectorProfileCredentials) ((Sensitive Text -> f (Sensitive Text))
 -> RedshiftConnectorProfileCredentials
 -> f RedshiftConnectorProfileCredentials)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> RedshiftConnectorProfileCredentials
-> f RedshiftConnectorProfileCredentials
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance
  Prelude.Hashable
    RedshiftConnectorProfileCredentials

instance
  Prelude.NFData
    RedshiftConnectorProfileCredentials

instance
  Core.ToJSON
    RedshiftConnectorProfileCredentials
  where
  toJSON :: RedshiftConnectorProfileCredentials -> Value
toJSON RedshiftConnectorProfileCredentials' {Text
Sensitive Text
password :: Sensitive Text
username :: Text
$sel:password:RedshiftConnectorProfileCredentials' :: RedshiftConnectorProfileCredentials -> Sensitive Text
$sel:username:RedshiftConnectorProfileCredentials' :: RedshiftConnectorProfileCredentials -> 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 -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
password)
          ]
      )