{-# 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.CreateConnectionApiKeyAuthRequestParameters
-- 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.CreateConnectionApiKeyAuthRequestParameters where

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

-- | Contains the API key authorization parameters for the connection.
--
-- /See:/ 'newCreateConnectionApiKeyAuthRequestParameters' smart constructor.
data CreateConnectionApiKeyAuthRequestParameters = CreateConnectionApiKeyAuthRequestParameters'
  { -- | The name of the API key to use for authorization.
    CreateConnectionApiKeyAuthRequestParameters -> Text
apiKeyName :: Prelude.Text,
    -- | The value for the API key to use for authorization.
    CreateConnectionApiKeyAuthRequestParameters -> Text
apiKeyValue :: Prelude.Text
  }
  deriving (CreateConnectionApiKeyAuthRequestParameters
-> CreateConnectionApiKeyAuthRequestParameters -> Bool
(CreateConnectionApiKeyAuthRequestParameters
 -> CreateConnectionApiKeyAuthRequestParameters -> Bool)
-> (CreateConnectionApiKeyAuthRequestParameters
    -> CreateConnectionApiKeyAuthRequestParameters -> Bool)
-> Eq CreateConnectionApiKeyAuthRequestParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConnectionApiKeyAuthRequestParameters
-> CreateConnectionApiKeyAuthRequestParameters -> Bool
$c/= :: CreateConnectionApiKeyAuthRequestParameters
-> CreateConnectionApiKeyAuthRequestParameters -> Bool
== :: CreateConnectionApiKeyAuthRequestParameters
-> CreateConnectionApiKeyAuthRequestParameters -> Bool
$c== :: CreateConnectionApiKeyAuthRequestParameters
-> CreateConnectionApiKeyAuthRequestParameters -> Bool
Prelude.Eq, ReadPrec [CreateConnectionApiKeyAuthRequestParameters]
ReadPrec CreateConnectionApiKeyAuthRequestParameters
Int -> ReadS CreateConnectionApiKeyAuthRequestParameters
ReadS [CreateConnectionApiKeyAuthRequestParameters]
(Int -> ReadS CreateConnectionApiKeyAuthRequestParameters)
-> ReadS [CreateConnectionApiKeyAuthRequestParameters]
-> ReadPrec CreateConnectionApiKeyAuthRequestParameters
-> ReadPrec [CreateConnectionApiKeyAuthRequestParameters]
-> Read CreateConnectionApiKeyAuthRequestParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConnectionApiKeyAuthRequestParameters]
$creadListPrec :: ReadPrec [CreateConnectionApiKeyAuthRequestParameters]
readPrec :: ReadPrec CreateConnectionApiKeyAuthRequestParameters
$creadPrec :: ReadPrec CreateConnectionApiKeyAuthRequestParameters
readList :: ReadS [CreateConnectionApiKeyAuthRequestParameters]
$creadList :: ReadS [CreateConnectionApiKeyAuthRequestParameters]
readsPrec :: Int -> ReadS CreateConnectionApiKeyAuthRequestParameters
$creadsPrec :: Int -> ReadS CreateConnectionApiKeyAuthRequestParameters
Prelude.Read, Int -> CreateConnectionApiKeyAuthRequestParameters -> ShowS
[CreateConnectionApiKeyAuthRequestParameters] -> ShowS
CreateConnectionApiKeyAuthRequestParameters -> String
(Int -> CreateConnectionApiKeyAuthRequestParameters -> ShowS)
-> (CreateConnectionApiKeyAuthRequestParameters -> String)
-> ([CreateConnectionApiKeyAuthRequestParameters] -> ShowS)
-> Show CreateConnectionApiKeyAuthRequestParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConnectionApiKeyAuthRequestParameters] -> ShowS
$cshowList :: [CreateConnectionApiKeyAuthRequestParameters] -> ShowS
show :: CreateConnectionApiKeyAuthRequestParameters -> String
$cshow :: CreateConnectionApiKeyAuthRequestParameters -> String
showsPrec :: Int -> CreateConnectionApiKeyAuthRequestParameters -> ShowS
$cshowsPrec :: Int -> CreateConnectionApiKeyAuthRequestParameters -> ShowS
Prelude.Show, (forall x.
 CreateConnectionApiKeyAuthRequestParameters
 -> Rep CreateConnectionApiKeyAuthRequestParameters x)
-> (forall x.
    Rep CreateConnectionApiKeyAuthRequestParameters x
    -> CreateConnectionApiKeyAuthRequestParameters)
-> Generic CreateConnectionApiKeyAuthRequestParameters
forall x.
Rep CreateConnectionApiKeyAuthRequestParameters x
-> CreateConnectionApiKeyAuthRequestParameters
forall x.
CreateConnectionApiKeyAuthRequestParameters
-> Rep CreateConnectionApiKeyAuthRequestParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConnectionApiKeyAuthRequestParameters x
-> CreateConnectionApiKeyAuthRequestParameters
$cfrom :: forall x.
CreateConnectionApiKeyAuthRequestParameters
-> Rep CreateConnectionApiKeyAuthRequestParameters x
Prelude.Generic)

-- |
-- Create a value of 'CreateConnectionApiKeyAuthRequestParameters' 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', 'createConnectionApiKeyAuthRequestParameters_apiKeyName' - The name of the API key to use for authorization.
--
-- 'apiKeyValue', 'createConnectionApiKeyAuthRequestParameters_apiKeyValue' - The value for the API key to use for authorization.
newCreateConnectionApiKeyAuthRequestParameters ::
  -- | 'apiKeyName'
  Prelude.Text ->
  -- | 'apiKeyValue'
  Prelude.Text ->
  CreateConnectionApiKeyAuthRequestParameters
newCreateConnectionApiKeyAuthRequestParameters :: Text -> Text -> CreateConnectionApiKeyAuthRequestParameters
newCreateConnectionApiKeyAuthRequestParameters
  Text
pApiKeyName_
  Text
pApiKeyValue_ =
    CreateConnectionApiKeyAuthRequestParameters' :: Text -> Text -> CreateConnectionApiKeyAuthRequestParameters
CreateConnectionApiKeyAuthRequestParameters'
      { $sel:apiKeyName:CreateConnectionApiKeyAuthRequestParameters' :: Text
apiKeyName =
          Text
pApiKeyName_,
        $sel:apiKeyValue:CreateConnectionApiKeyAuthRequestParameters' :: Text
apiKeyValue = Text
pApiKeyValue_
      }

-- | The name of the API key to use for authorization.
createConnectionApiKeyAuthRequestParameters_apiKeyName :: Lens.Lens' CreateConnectionApiKeyAuthRequestParameters Prelude.Text
createConnectionApiKeyAuthRequestParameters_apiKeyName :: (Text -> f Text)
-> CreateConnectionApiKeyAuthRequestParameters
-> f CreateConnectionApiKeyAuthRequestParameters
createConnectionApiKeyAuthRequestParameters_apiKeyName = (CreateConnectionApiKeyAuthRequestParameters -> Text)
-> (CreateConnectionApiKeyAuthRequestParameters
    -> Text -> CreateConnectionApiKeyAuthRequestParameters)
-> Lens
     CreateConnectionApiKeyAuthRequestParameters
     CreateConnectionApiKeyAuthRequestParameters
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionApiKeyAuthRequestParameters' {Text
apiKeyName :: Text
$sel:apiKeyName:CreateConnectionApiKeyAuthRequestParameters' :: CreateConnectionApiKeyAuthRequestParameters -> Text
apiKeyName} -> Text
apiKeyName) (\s :: CreateConnectionApiKeyAuthRequestParameters
s@CreateConnectionApiKeyAuthRequestParameters' {} Text
a -> CreateConnectionApiKeyAuthRequestParameters
s {$sel:apiKeyName:CreateConnectionApiKeyAuthRequestParameters' :: Text
apiKeyName = Text
a} :: CreateConnectionApiKeyAuthRequestParameters)

-- | The value for the API key to use for authorization.
createConnectionApiKeyAuthRequestParameters_apiKeyValue :: Lens.Lens' CreateConnectionApiKeyAuthRequestParameters Prelude.Text
createConnectionApiKeyAuthRequestParameters_apiKeyValue :: (Text -> f Text)
-> CreateConnectionApiKeyAuthRequestParameters
-> f CreateConnectionApiKeyAuthRequestParameters
createConnectionApiKeyAuthRequestParameters_apiKeyValue = (CreateConnectionApiKeyAuthRequestParameters -> Text)
-> (CreateConnectionApiKeyAuthRequestParameters
    -> Text -> CreateConnectionApiKeyAuthRequestParameters)
-> Lens
     CreateConnectionApiKeyAuthRequestParameters
     CreateConnectionApiKeyAuthRequestParameters
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionApiKeyAuthRequestParameters' {Text
apiKeyValue :: Text
$sel:apiKeyValue:CreateConnectionApiKeyAuthRequestParameters' :: CreateConnectionApiKeyAuthRequestParameters -> Text
apiKeyValue} -> Text
apiKeyValue) (\s :: CreateConnectionApiKeyAuthRequestParameters
s@CreateConnectionApiKeyAuthRequestParameters' {} Text
a -> CreateConnectionApiKeyAuthRequestParameters
s {$sel:apiKeyValue:CreateConnectionApiKeyAuthRequestParameters' :: Text
apiKeyValue = Text
a} :: CreateConnectionApiKeyAuthRequestParameters)

instance
  Prelude.Hashable
    CreateConnectionApiKeyAuthRequestParameters

instance
  Prelude.NFData
    CreateConnectionApiKeyAuthRequestParameters

instance
  Core.ToJSON
    CreateConnectionApiKeyAuthRequestParameters
  where
  toJSON :: CreateConnectionApiKeyAuthRequestParameters -> Value
toJSON
    CreateConnectionApiKeyAuthRequestParameters' {Text
apiKeyValue :: Text
apiKeyName :: Text
$sel:apiKeyValue:CreateConnectionApiKeyAuthRequestParameters' :: CreateConnectionApiKeyAuthRequestParameters -> Text
$sel:apiKeyName:CreateConnectionApiKeyAuthRequestParameters' :: CreateConnectionApiKeyAuthRequestParameters -> 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
"ApiKeyName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
apiKeyName),
              Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ApiKeyValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
apiKeyValue)
            ]
        )