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

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

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

instance
  Prelude.NFData
    ServiceNowConnectorProfileCredentials

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