{-# 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.KafkaConnect.Types.KafkaClusterClientAuthentication
-- 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.KafkaConnect.Types.KafkaClusterClientAuthentication where

import qualified Amazonka.Core as Core
import Amazonka.KafkaConnect.Types.KafkaClusterClientAuthenticationType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The client authentication information used in order to authenticate with
-- the Apache Kafka cluster.
--
-- /See:/ 'newKafkaClusterClientAuthentication' smart constructor.
data KafkaClusterClientAuthentication = KafkaClusterClientAuthentication'
  { -- | The type of client authentication used to connect to the Apache Kafka
    -- cluster. Value NONE means that no client authentication is used.
    KafkaClusterClientAuthentication
-> KafkaClusterClientAuthenticationType
authenticationType :: KafkaClusterClientAuthenticationType
  }
  deriving (KafkaClusterClientAuthentication
-> KafkaClusterClientAuthentication -> Bool
(KafkaClusterClientAuthentication
 -> KafkaClusterClientAuthentication -> Bool)
-> (KafkaClusterClientAuthentication
    -> KafkaClusterClientAuthentication -> Bool)
-> Eq KafkaClusterClientAuthentication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KafkaClusterClientAuthentication
-> KafkaClusterClientAuthentication -> Bool
$c/= :: KafkaClusterClientAuthentication
-> KafkaClusterClientAuthentication -> Bool
== :: KafkaClusterClientAuthentication
-> KafkaClusterClientAuthentication -> Bool
$c== :: KafkaClusterClientAuthentication
-> KafkaClusterClientAuthentication -> Bool
Prelude.Eq, ReadPrec [KafkaClusterClientAuthentication]
ReadPrec KafkaClusterClientAuthentication
Int -> ReadS KafkaClusterClientAuthentication
ReadS [KafkaClusterClientAuthentication]
(Int -> ReadS KafkaClusterClientAuthentication)
-> ReadS [KafkaClusterClientAuthentication]
-> ReadPrec KafkaClusterClientAuthentication
-> ReadPrec [KafkaClusterClientAuthentication]
-> Read KafkaClusterClientAuthentication
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KafkaClusterClientAuthentication]
$creadListPrec :: ReadPrec [KafkaClusterClientAuthentication]
readPrec :: ReadPrec KafkaClusterClientAuthentication
$creadPrec :: ReadPrec KafkaClusterClientAuthentication
readList :: ReadS [KafkaClusterClientAuthentication]
$creadList :: ReadS [KafkaClusterClientAuthentication]
readsPrec :: Int -> ReadS KafkaClusterClientAuthentication
$creadsPrec :: Int -> ReadS KafkaClusterClientAuthentication
Prelude.Read, Int -> KafkaClusterClientAuthentication -> ShowS
[KafkaClusterClientAuthentication] -> ShowS
KafkaClusterClientAuthentication -> String
(Int -> KafkaClusterClientAuthentication -> ShowS)
-> (KafkaClusterClientAuthentication -> String)
-> ([KafkaClusterClientAuthentication] -> ShowS)
-> Show KafkaClusterClientAuthentication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KafkaClusterClientAuthentication] -> ShowS
$cshowList :: [KafkaClusterClientAuthentication] -> ShowS
show :: KafkaClusterClientAuthentication -> String
$cshow :: KafkaClusterClientAuthentication -> String
showsPrec :: Int -> KafkaClusterClientAuthentication -> ShowS
$cshowsPrec :: Int -> KafkaClusterClientAuthentication -> ShowS
Prelude.Show, (forall x.
 KafkaClusterClientAuthentication
 -> Rep KafkaClusterClientAuthentication x)
-> (forall x.
    Rep KafkaClusterClientAuthentication x
    -> KafkaClusterClientAuthentication)
-> Generic KafkaClusterClientAuthentication
forall x.
Rep KafkaClusterClientAuthentication x
-> KafkaClusterClientAuthentication
forall x.
KafkaClusterClientAuthentication
-> Rep KafkaClusterClientAuthentication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep KafkaClusterClientAuthentication x
-> KafkaClusterClientAuthentication
$cfrom :: forall x.
KafkaClusterClientAuthentication
-> Rep KafkaClusterClientAuthentication x
Prelude.Generic)

-- |
-- Create a value of 'KafkaClusterClientAuthentication' 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:
--
-- 'authenticationType', 'kafkaClusterClientAuthentication_authenticationType' - The type of client authentication used to connect to the Apache Kafka
-- cluster. Value NONE means that no client authentication is used.
newKafkaClusterClientAuthentication ::
  -- | 'authenticationType'
  KafkaClusterClientAuthenticationType ->
  KafkaClusterClientAuthentication
newKafkaClusterClientAuthentication :: KafkaClusterClientAuthenticationType
-> KafkaClusterClientAuthentication
newKafkaClusterClientAuthentication
  KafkaClusterClientAuthenticationType
pAuthenticationType_ =
    KafkaClusterClientAuthentication' :: KafkaClusterClientAuthenticationType
-> KafkaClusterClientAuthentication
KafkaClusterClientAuthentication'
      { $sel:authenticationType:KafkaClusterClientAuthentication' :: KafkaClusterClientAuthenticationType
authenticationType =
          KafkaClusterClientAuthenticationType
pAuthenticationType_
      }

-- | The type of client authentication used to connect to the Apache Kafka
-- cluster. Value NONE means that no client authentication is used.
kafkaClusterClientAuthentication_authenticationType :: Lens.Lens' KafkaClusterClientAuthentication KafkaClusterClientAuthenticationType
kafkaClusterClientAuthentication_authenticationType :: (KafkaClusterClientAuthenticationType
 -> f KafkaClusterClientAuthenticationType)
-> KafkaClusterClientAuthentication
-> f KafkaClusterClientAuthentication
kafkaClusterClientAuthentication_authenticationType = (KafkaClusterClientAuthentication
 -> KafkaClusterClientAuthenticationType)
-> (KafkaClusterClientAuthentication
    -> KafkaClusterClientAuthenticationType
    -> KafkaClusterClientAuthentication)
-> Lens
     KafkaClusterClientAuthentication
     KafkaClusterClientAuthentication
     KafkaClusterClientAuthenticationType
     KafkaClusterClientAuthenticationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KafkaClusterClientAuthentication' {KafkaClusterClientAuthenticationType
authenticationType :: KafkaClusterClientAuthenticationType
$sel:authenticationType:KafkaClusterClientAuthentication' :: KafkaClusterClientAuthentication
-> KafkaClusterClientAuthenticationType
authenticationType} -> KafkaClusterClientAuthenticationType
authenticationType) (\s :: KafkaClusterClientAuthentication
s@KafkaClusterClientAuthentication' {} KafkaClusterClientAuthenticationType
a -> KafkaClusterClientAuthentication
s {$sel:authenticationType:KafkaClusterClientAuthentication' :: KafkaClusterClientAuthenticationType
authenticationType = KafkaClusterClientAuthenticationType
a} :: KafkaClusterClientAuthentication)

instance
  Prelude.Hashable
    KafkaClusterClientAuthentication

instance
  Prelude.NFData
    KafkaClusterClientAuthentication

instance Core.ToJSON KafkaClusterClientAuthentication where
  toJSON :: KafkaClusterClientAuthentication -> Value
toJSON KafkaClusterClientAuthentication' {KafkaClusterClientAuthenticationType
authenticationType :: KafkaClusterClientAuthenticationType
$sel:authenticationType:KafkaClusterClientAuthentication' :: KafkaClusterClientAuthentication
-> KafkaClusterClientAuthenticationType
..} =
    [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
"authenticationType" Text -> KafkaClusterClientAuthenticationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= KafkaClusterClientAuthenticationType
authenticationType)
          ]
      )