{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudWatchEvents.Types.ConnectionApiKeyAuthResponseParameters 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

-- | 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
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]
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
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.
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'
    { $sel:apiKeyName:ConnectionApiKeyAuthResponseParameters' :: Maybe Text
apiKeyName =
        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 :: Lens' ConnectionApiKeyAuthResponseParameters (Maybe Text)
connectionApiKeyAuthResponseParameters_apiKeyName = 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
  Data.FromJSON
    ConnectionApiKeyAuthResponseParameters
  where
  parseJSON :: Value -> Parser ConnectionApiKeyAuthResponseParameters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConnectionApiKeyAuthResponseParameters"
      ( \Object
x ->
          Maybe Text -> ConnectionApiKeyAuthResponseParameters
ConnectionApiKeyAuthResponseParameters'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ApiKeyName")
      )

instance
  Prelude.Hashable
    ConnectionApiKeyAuthResponseParameters
  where
  hashWithSalt :: Int -> ConnectionApiKeyAuthResponseParameters -> Int
hashWithSalt
    Int
_salt
    ConnectionApiKeyAuthResponseParameters' {Maybe Text
apiKeyName :: Maybe Text
$sel:apiKeyName:ConnectionApiKeyAuthResponseParameters' :: ConnectionApiKeyAuthResponseParameters -> Maybe Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
apiKeyName

instance
  Prelude.NFData
    ConnectionApiKeyAuthResponseParameters
  where
  rnf :: ConnectionApiKeyAuthResponseParameters -> ()
rnf ConnectionApiKeyAuthResponseParameters' {Maybe Text
apiKeyName :: Maybe Text
$sel:apiKeyName:ConnectionApiKeyAuthResponseParameters' :: ConnectionApiKeyAuthResponseParameters -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
apiKeyName