{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppFlow.Types.RedshiftConnectorProfileCredentials 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 connector-specific profile credentials required when using Amazon
-- Redshift.
--
-- /See:/ 'newRedshiftConnectorProfileCredentials' smart constructor.
data RedshiftConnectorProfileCredentials = RedshiftConnectorProfileCredentials'
  { -- | The password that corresponds to the user name.
    RedshiftConnectorProfileCredentials -> Maybe (Sensitive Text)
password :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The name of the user.
    RedshiftConnectorProfileCredentials -> Maybe Text
username :: Prelude.Maybe Prelude.Text
  }
  deriving (RedshiftConnectorProfileCredentials
-> RedshiftConnectorProfileCredentials -> Bool
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
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.
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:
--
-- 'password', 'redshiftConnectorProfileCredentials_password' - The password that corresponds to the user name.
--
-- 'username', 'redshiftConnectorProfileCredentials_username' - The name of the user.
newRedshiftConnectorProfileCredentials ::
  RedshiftConnectorProfileCredentials
newRedshiftConnectorProfileCredentials :: RedshiftConnectorProfileCredentials
newRedshiftConnectorProfileCredentials =
  RedshiftConnectorProfileCredentials'
    { $sel:password:RedshiftConnectorProfileCredentials' :: Maybe (Sensitive Text)
password =
        forall a. Maybe a
Prelude.Nothing,
      $sel:username:RedshiftConnectorProfileCredentials' :: Maybe Text
username = forall a. Maybe a
Prelude.Nothing
    }

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

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

instance
  Prelude.Hashable
    RedshiftConnectorProfileCredentials
  where
  hashWithSalt :: Int -> RedshiftConnectorProfileCredentials -> Int
hashWithSalt
    Int
_salt
    RedshiftConnectorProfileCredentials' {Maybe Text
Maybe (Sensitive Text)
username :: Maybe Text
password :: Maybe (Sensitive Text)
$sel:username:RedshiftConnectorProfileCredentials' :: RedshiftConnectorProfileCredentials -> Maybe Text
$sel:password:RedshiftConnectorProfileCredentials' :: RedshiftConnectorProfileCredentials -> Maybe (Sensitive Text)
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
password
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
username

instance
  Prelude.NFData
    RedshiftConnectorProfileCredentials
  where
  rnf :: RedshiftConnectorProfileCredentials -> ()
rnf RedshiftConnectorProfileCredentials' {Maybe Text
Maybe (Sensitive Text)
username :: Maybe Text
password :: Maybe (Sensitive Text)
$sel:username:RedshiftConnectorProfileCredentials' :: RedshiftConnectorProfileCredentials -> Maybe Text
$sel:password:RedshiftConnectorProfileCredentials' :: RedshiftConnectorProfileCredentials -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
password
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
username

instance
  Data.ToJSON
    RedshiftConnectorProfileCredentials
  where
  toJSON :: RedshiftConnectorProfileCredentials -> Value
toJSON RedshiftConnectorProfileCredentials' {Maybe Text
Maybe (Sensitive Text)
username :: Maybe Text
password :: Maybe (Sensitive Text)
$sel:username:RedshiftConnectorProfileCredentials' :: RedshiftConnectorProfileCredentials -> Maybe Text
$sel:password:RedshiftConnectorProfileCredentials' :: RedshiftConnectorProfileCredentials -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"password" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
password,
            (Key
"username" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
username
          ]
      )