{-# 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.VeevaConnectorProfileCredentials
-- 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.VeevaConnectorProfileCredentials 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 Veeva.
--
-- /See:/ 'newVeevaConnectorProfileCredentials' smart constructor.
data VeevaConnectorProfileCredentials = VeevaConnectorProfileCredentials'
  { -- | The name of the user.
    VeevaConnectorProfileCredentials -> Text
username :: Prelude.Text,
    -- | The password that corresponds to the user name.
    VeevaConnectorProfileCredentials -> Sensitive Text
password :: Core.Sensitive Prelude.Text
  }
  deriving (VeevaConnectorProfileCredentials
-> VeevaConnectorProfileCredentials -> Bool
(VeevaConnectorProfileCredentials
 -> VeevaConnectorProfileCredentials -> Bool)
-> (VeevaConnectorProfileCredentials
    -> VeevaConnectorProfileCredentials -> Bool)
-> Eq VeevaConnectorProfileCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VeevaConnectorProfileCredentials
-> VeevaConnectorProfileCredentials -> Bool
$c/= :: VeevaConnectorProfileCredentials
-> VeevaConnectorProfileCredentials -> Bool
== :: VeevaConnectorProfileCredentials
-> VeevaConnectorProfileCredentials -> Bool
$c== :: VeevaConnectorProfileCredentials
-> VeevaConnectorProfileCredentials -> Bool
Prelude.Eq, Int -> VeevaConnectorProfileCredentials -> ShowS
[VeevaConnectorProfileCredentials] -> ShowS
VeevaConnectorProfileCredentials -> String
(Int -> VeevaConnectorProfileCredentials -> ShowS)
-> (VeevaConnectorProfileCredentials -> String)
-> ([VeevaConnectorProfileCredentials] -> ShowS)
-> Show VeevaConnectorProfileCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VeevaConnectorProfileCredentials] -> ShowS
$cshowList :: [VeevaConnectorProfileCredentials] -> ShowS
show :: VeevaConnectorProfileCredentials -> String
$cshow :: VeevaConnectorProfileCredentials -> String
showsPrec :: Int -> VeevaConnectorProfileCredentials -> ShowS
$cshowsPrec :: Int -> VeevaConnectorProfileCredentials -> ShowS
Prelude.Show, (forall x.
 VeevaConnectorProfileCredentials
 -> Rep VeevaConnectorProfileCredentials x)
-> (forall x.
    Rep VeevaConnectorProfileCredentials x
    -> VeevaConnectorProfileCredentials)
-> Generic VeevaConnectorProfileCredentials
forall x.
Rep VeevaConnectorProfileCredentials x
-> VeevaConnectorProfileCredentials
forall x.
VeevaConnectorProfileCredentials
-> Rep VeevaConnectorProfileCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VeevaConnectorProfileCredentials x
-> VeevaConnectorProfileCredentials
$cfrom :: forall x.
VeevaConnectorProfileCredentials
-> Rep VeevaConnectorProfileCredentials x
Prelude.Generic)

-- |
-- Create a value of 'VeevaConnectorProfileCredentials' 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', 'veevaConnectorProfileCredentials_username' - The name of the user.
--
-- 'password', 'veevaConnectorProfileCredentials_password' - The password that corresponds to the user name.
newVeevaConnectorProfileCredentials ::
  -- | 'username'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  VeevaConnectorProfileCredentials
newVeevaConnectorProfileCredentials :: Text -> Text -> VeevaConnectorProfileCredentials
newVeevaConnectorProfileCredentials
  Text
pUsername_
  Text
pPassword_ =
    VeevaConnectorProfileCredentials' :: Text -> Sensitive Text -> VeevaConnectorProfileCredentials
VeevaConnectorProfileCredentials'
      { $sel:username:VeevaConnectorProfileCredentials' :: Text
username =
          Text
pUsername_,
        $sel:password:VeevaConnectorProfileCredentials' :: 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.
veevaConnectorProfileCredentials_username :: Lens.Lens' VeevaConnectorProfileCredentials Prelude.Text
veevaConnectorProfileCredentials_username :: (Text -> f Text)
-> VeevaConnectorProfileCredentials
-> f VeevaConnectorProfileCredentials
veevaConnectorProfileCredentials_username = (VeevaConnectorProfileCredentials -> Text)
-> (VeevaConnectorProfileCredentials
    -> Text -> VeevaConnectorProfileCredentials)
-> Lens
     VeevaConnectorProfileCredentials
     VeevaConnectorProfileCredentials
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VeevaConnectorProfileCredentials' {Text
username :: Text
$sel:username:VeevaConnectorProfileCredentials' :: VeevaConnectorProfileCredentials -> Text
username} -> Text
username) (\s :: VeevaConnectorProfileCredentials
s@VeevaConnectorProfileCredentials' {} Text
a -> VeevaConnectorProfileCredentials
s {$sel:username:VeevaConnectorProfileCredentials' :: Text
username = Text
a} :: VeevaConnectorProfileCredentials)

-- | The password that corresponds to the user name.
veevaConnectorProfileCredentials_password :: Lens.Lens' VeevaConnectorProfileCredentials Prelude.Text
veevaConnectorProfileCredentials_password :: (Text -> f Text)
-> VeevaConnectorProfileCredentials
-> f VeevaConnectorProfileCredentials
veevaConnectorProfileCredentials_password = (VeevaConnectorProfileCredentials -> Sensitive Text)
-> (VeevaConnectorProfileCredentials
    -> Sensitive Text -> VeevaConnectorProfileCredentials)
-> Lens
     VeevaConnectorProfileCredentials
     VeevaConnectorProfileCredentials
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VeevaConnectorProfileCredentials' {Sensitive Text
password :: Sensitive Text
$sel:password:VeevaConnectorProfileCredentials' :: VeevaConnectorProfileCredentials -> Sensitive Text
password} -> Sensitive Text
password) (\s :: VeevaConnectorProfileCredentials
s@VeevaConnectorProfileCredentials' {} Sensitive Text
a -> VeevaConnectorProfileCredentials
s {$sel:password:VeevaConnectorProfileCredentials' :: Sensitive Text
password = Sensitive Text
a} :: VeevaConnectorProfileCredentials) ((Sensitive Text -> f (Sensitive Text))
 -> VeevaConnectorProfileCredentials
 -> f VeevaConnectorProfileCredentials)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> VeevaConnectorProfileCredentials
-> f VeevaConnectorProfileCredentials
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
    VeevaConnectorProfileCredentials

instance
  Prelude.NFData
    VeevaConnectorProfileCredentials

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