{-# 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.CustomAuthCredentials
-- 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.CustomAuthCredentials 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 custom credentials required for custom authentication.
--
-- /See:/ 'newCustomAuthCredentials' smart constructor.
data CustomAuthCredentials = CustomAuthCredentials'
  { -- | A map that holds custom authentication credentials.
    CustomAuthCredentials -> Maybe (HashMap Text (Sensitive Text))
credentialsMap :: Prelude.Maybe (Prelude.HashMap Prelude.Text (Data.Sensitive Prelude.Text)),
    -- | The custom authentication type that the connector uses.
    CustomAuthCredentials -> Text
customAuthenticationType :: Prelude.Text
  }
  deriving (CustomAuthCredentials -> CustomAuthCredentials -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomAuthCredentials -> CustomAuthCredentials -> Bool
$c/= :: CustomAuthCredentials -> CustomAuthCredentials -> Bool
== :: CustomAuthCredentials -> CustomAuthCredentials -> Bool
$c== :: CustomAuthCredentials -> CustomAuthCredentials -> Bool
Prelude.Eq, Int -> CustomAuthCredentials -> ShowS
[CustomAuthCredentials] -> ShowS
CustomAuthCredentials -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomAuthCredentials] -> ShowS
$cshowList :: [CustomAuthCredentials] -> ShowS
show :: CustomAuthCredentials -> String
$cshow :: CustomAuthCredentials -> String
showsPrec :: Int -> CustomAuthCredentials -> ShowS
$cshowsPrec :: Int -> CustomAuthCredentials -> ShowS
Prelude.Show, forall x. Rep CustomAuthCredentials x -> CustomAuthCredentials
forall x. CustomAuthCredentials -> Rep CustomAuthCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomAuthCredentials x -> CustomAuthCredentials
$cfrom :: forall x. CustomAuthCredentials -> Rep CustomAuthCredentials x
Prelude.Generic)

-- |
-- Create a value of 'CustomAuthCredentials' 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:
--
-- 'credentialsMap', 'customAuthCredentials_credentialsMap' - A map that holds custom authentication credentials.
--
-- 'customAuthenticationType', 'customAuthCredentials_customAuthenticationType' - The custom authentication type that the connector uses.
newCustomAuthCredentials ::
  -- | 'customAuthenticationType'
  Prelude.Text ->
  CustomAuthCredentials
newCustomAuthCredentials :: Text -> CustomAuthCredentials
newCustomAuthCredentials Text
pCustomAuthenticationType_ =
  CustomAuthCredentials'
    { $sel:credentialsMap:CustomAuthCredentials' :: Maybe (HashMap Text (Sensitive Text))
credentialsMap =
        forall a. Maybe a
Prelude.Nothing,
      $sel:customAuthenticationType:CustomAuthCredentials' :: Text
customAuthenticationType =
        Text
pCustomAuthenticationType_
    }

-- | A map that holds custom authentication credentials.
customAuthCredentials_credentialsMap :: Lens.Lens' CustomAuthCredentials (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
customAuthCredentials_credentialsMap :: Lens' CustomAuthCredentials (Maybe (HashMap Text Text))
customAuthCredentials_credentialsMap = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomAuthCredentials' {Maybe (HashMap Text (Sensitive Text))
credentialsMap :: Maybe (HashMap Text (Sensitive Text))
$sel:credentialsMap:CustomAuthCredentials' :: CustomAuthCredentials -> Maybe (HashMap Text (Sensitive Text))
credentialsMap} -> Maybe (HashMap Text (Sensitive Text))
credentialsMap) (\s :: CustomAuthCredentials
s@CustomAuthCredentials' {} Maybe (HashMap Text (Sensitive Text))
a -> CustomAuthCredentials
s {$sel:credentialsMap:CustomAuthCredentials' :: Maybe (HashMap Text (Sensitive Text))
credentialsMap = Maybe (HashMap Text (Sensitive Text))
a} :: CustomAuthCredentials) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The custom authentication type that the connector uses.
customAuthCredentials_customAuthenticationType :: Lens.Lens' CustomAuthCredentials Prelude.Text
customAuthCredentials_customAuthenticationType :: Lens' CustomAuthCredentials Text
customAuthCredentials_customAuthenticationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomAuthCredentials' {Text
customAuthenticationType :: Text
$sel:customAuthenticationType:CustomAuthCredentials' :: CustomAuthCredentials -> Text
customAuthenticationType} -> Text
customAuthenticationType) (\s :: CustomAuthCredentials
s@CustomAuthCredentials' {} Text
a -> CustomAuthCredentials
s {$sel:customAuthenticationType:CustomAuthCredentials' :: Text
customAuthenticationType = Text
a} :: CustomAuthCredentials)

instance Prelude.Hashable CustomAuthCredentials where
  hashWithSalt :: Int -> CustomAuthCredentials -> Int
hashWithSalt Int
_salt CustomAuthCredentials' {Maybe (HashMap Text (Sensitive Text))
Text
customAuthenticationType :: Text
credentialsMap :: Maybe (HashMap Text (Sensitive Text))
$sel:customAuthenticationType:CustomAuthCredentials' :: CustomAuthCredentials -> Text
$sel:credentialsMap:CustomAuthCredentials' :: CustomAuthCredentials -> Maybe (HashMap Text (Sensitive Text))
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text (Sensitive Text))
credentialsMap
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
customAuthenticationType

instance Prelude.NFData CustomAuthCredentials where
  rnf :: CustomAuthCredentials -> ()
rnf CustomAuthCredentials' {Maybe (HashMap Text (Sensitive Text))
Text
customAuthenticationType :: Text
credentialsMap :: Maybe (HashMap Text (Sensitive Text))
$sel:customAuthenticationType:CustomAuthCredentials' :: CustomAuthCredentials -> Text
$sel:credentialsMap:CustomAuthCredentials' :: CustomAuthCredentials -> Maybe (HashMap Text (Sensitive Text))
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text (Sensitive Text))
credentialsMap
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
customAuthenticationType

instance Data.ToJSON CustomAuthCredentials where
  toJSON :: CustomAuthCredentials -> Value
toJSON CustomAuthCredentials' {Maybe (HashMap Text (Sensitive Text))
Text
customAuthenticationType :: Text
credentialsMap :: Maybe (HashMap Text (Sensitive Text))
$sel:customAuthenticationType:CustomAuthCredentials' :: CustomAuthCredentials -> Text
$sel:credentialsMap:CustomAuthCredentials' :: CustomAuthCredentials -> Maybe (HashMap Text (Sensitive Text))
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"credentialsMap" 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 (HashMap Text (Sensitive Text))
credentialsMap,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"customAuthenticationType"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
customAuthenticationType
              )
          ]
      )