{-# 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.CloudWatchEvents.Types.ConnectionApiKeyAuthResponseParameters
-- 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.CloudWatchEvents.Types.ConnectionApiKeyAuthResponseParameters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the authorization parameters for the connection if API Key is
-- specified as the authorization type.
--
-- /See:/ 'newConnectionApiKeyAuthResponseParameters' smart constructor.
data ConnectionApiKeyAuthResponseParameters = ConnectionApiKeyAuthResponseParameters'
  { -- | The name of the header to use for the @APIKeyValue@ used for
    -- authorization.
    ConnectionApiKeyAuthResponseParameters -> Maybe Text
apiKeyName :: Prelude.Maybe Prelude.Text
  }
  deriving (ConnectionApiKeyAuthResponseParameters
-> ConnectionApiKeyAuthResponseParameters -> Bool
(ConnectionApiKeyAuthResponseParameters
 -> ConnectionApiKeyAuthResponseParameters -> Bool)
-> (ConnectionApiKeyAuthResponseParameters
    -> ConnectionApiKeyAuthResponseParameters -> Bool)
-> Eq ConnectionApiKeyAuthResponseParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionApiKeyAuthResponseParameters
-> ConnectionApiKeyAuthResponseParameters -> Bool
$c/= :: ConnectionApiKeyAuthResponseParameters
-> ConnectionApiKeyAuthResponseParameters -> Bool
== :: ConnectionApiKeyAuthResponseParameters
-> ConnectionApiKeyAuthResponseParameters -> Bool
$c== :: ConnectionApiKeyAuthResponseParameters
-> ConnectionApiKeyAuthResponseParameters -> Bool
Prelude.Eq, ReadPrec [ConnectionApiKeyAuthResponseParameters]
ReadPrec ConnectionApiKeyAuthResponseParameters
Int -> ReadS ConnectionApiKeyAuthResponseParameters
ReadS [ConnectionApiKeyAuthResponseParameters]
(Int -> ReadS ConnectionApiKeyAuthResponseParameters)
-> ReadS [ConnectionApiKeyAuthResponseParameters]
-> ReadPrec ConnectionApiKeyAuthResponseParameters
-> ReadPrec [ConnectionApiKeyAuthResponseParameters]
-> Read ConnectionApiKeyAuthResponseParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionApiKeyAuthResponseParameters]
$creadListPrec :: ReadPrec [ConnectionApiKeyAuthResponseParameters]
readPrec :: ReadPrec ConnectionApiKeyAuthResponseParameters
$creadPrec :: ReadPrec ConnectionApiKeyAuthResponseParameters
readList :: ReadS [ConnectionApiKeyAuthResponseParameters]
$creadList :: ReadS [ConnectionApiKeyAuthResponseParameters]
readsPrec :: Int -> ReadS ConnectionApiKeyAuthResponseParameters
$creadsPrec :: Int -> ReadS ConnectionApiKeyAuthResponseParameters
Prelude.Read, Int -> ConnectionApiKeyAuthResponseParameters -> ShowS
[ConnectionApiKeyAuthResponseParameters] -> ShowS
ConnectionApiKeyAuthResponseParameters -> String
(Int -> ConnectionApiKeyAuthResponseParameters -> ShowS)
-> (ConnectionApiKeyAuthResponseParameters -> String)
-> ([ConnectionApiKeyAuthResponseParameters] -> ShowS)
-> Show ConnectionApiKeyAuthResponseParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionApiKeyAuthResponseParameters] -> ShowS
$cshowList :: [ConnectionApiKeyAuthResponseParameters] -> ShowS
show :: ConnectionApiKeyAuthResponseParameters -> String
$cshow :: ConnectionApiKeyAuthResponseParameters -> String
showsPrec :: Int -> ConnectionApiKeyAuthResponseParameters -> ShowS
$cshowsPrec :: Int -> ConnectionApiKeyAuthResponseParameters -> ShowS
Prelude.Show, (forall x.
 ConnectionApiKeyAuthResponseParameters
 -> Rep ConnectionApiKeyAuthResponseParameters x)
-> (forall x.
    Rep ConnectionApiKeyAuthResponseParameters x
    -> ConnectionApiKeyAuthResponseParameters)
-> Generic ConnectionApiKeyAuthResponseParameters
forall x.
Rep ConnectionApiKeyAuthResponseParameters x
-> ConnectionApiKeyAuthResponseParameters
forall x.
ConnectionApiKeyAuthResponseParameters
-> Rep ConnectionApiKeyAuthResponseParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConnectionApiKeyAuthResponseParameters x
-> ConnectionApiKeyAuthResponseParameters
$cfrom :: forall x.
ConnectionApiKeyAuthResponseParameters
-> Rep ConnectionApiKeyAuthResponseParameters x
Prelude.Generic)

-- |
-- Create a value of 'ConnectionApiKeyAuthResponseParameters' 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:
--
-- 'apiKeyName', 'connectionApiKeyAuthResponseParameters_apiKeyName' - The name of the header to use for the @APIKeyValue@ used for
-- authorization.
newConnectionApiKeyAuthResponseParameters ::
  ConnectionApiKeyAuthResponseParameters
newConnectionApiKeyAuthResponseParameters :: ConnectionApiKeyAuthResponseParameters
newConnectionApiKeyAuthResponseParameters =
  ConnectionApiKeyAuthResponseParameters' :: Maybe Text -> ConnectionApiKeyAuthResponseParameters
ConnectionApiKeyAuthResponseParameters'
    { $sel:apiKeyName:ConnectionApiKeyAuthResponseParameters' :: Maybe Text
apiKeyName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the header to use for the @APIKeyValue@ used for
-- authorization.
connectionApiKeyAuthResponseParameters_apiKeyName :: Lens.Lens' ConnectionApiKeyAuthResponseParameters (Prelude.Maybe Prelude.Text)
connectionApiKeyAuthResponseParameters_apiKeyName :: (Maybe Text -> f (Maybe Text))
-> ConnectionApiKeyAuthResponseParameters
-> f ConnectionApiKeyAuthResponseParameters
connectionApiKeyAuthResponseParameters_apiKeyName = (ConnectionApiKeyAuthResponseParameters -> Maybe Text)
-> (ConnectionApiKeyAuthResponseParameters
    -> Maybe Text -> ConnectionApiKeyAuthResponseParameters)
-> Lens
     ConnectionApiKeyAuthResponseParameters
     ConnectionApiKeyAuthResponseParameters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionApiKeyAuthResponseParameters' {Maybe Text
apiKeyName :: Maybe Text
$sel:apiKeyName:ConnectionApiKeyAuthResponseParameters' :: ConnectionApiKeyAuthResponseParameters -> Maybe Text
apiKeyName} -> Maybe Text
apiKeyName) (\s :: ConnectionApiKeyAuthResponseParameters
s@ConnectionApiKeyAuthResponseParameters' {} Maybe Text
a -> ConnectionApiKeyAuthResponseParameters
s {$sel:apiKeyName:ConnectionApiKeyAuthResponseParameters' :: Maybe Text
apiKeyName = Maybe Text
a} :: ConnectionApiKeyAuthResponseParameters)

instance
  Core.FromJSON
    ConnectionApiKeyAuthResponseParameters
  where
  parseJSON :: Value -> Parser ConnectionApiKeyAuthResponseParameters
parseJSON =
    String
-> (Object -> Parser ConnectionApiKeyAuthResponseParameters)
-> Value
-> Parser ConnectionApiKeyAuthResponseParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConnectionApiKeyAuthResponseParameters"
      ( \Object
x ->
          Maybe Text -> ConnectionApiKeyAuthResponseParameters
ConnectionApiKeyAuthResponseParameters'
            (Maybe Text -> ConnectionApiKeyAuthResponseParameters)
-> Parser (Maybe Text)
-> Parser ConnectionApiKeyAuthResponseParameters
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ApiKeyName")
      )

instance
  Prelude.Hashable
    ConnectionApiKeyAuthResponseParameters

instance
  Prelude.NFData
    ConnectionApiKeyAuthResponseParameters