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

-- |
-- Create a value of 'UpdateConnectionApiKeyAuthRequestParameters' 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:
--
-- 'apiKeyValue', 'updateConnectionApiKeyAuthRequestParameters_apiKeyValue' - The value associated with teh API key to use for authorization.
--
-- 'apiKeyName', 'updateConnectionApiKeyAuthRequestParameters_apiKeyName' - The name of the API key to use for authorization.
newUpdateConnectionApiKeyAuthRequestParameters ::
  UpdateConnectionApiKeyAuthRequestParameters
newUpdateConnectionApiKeyAuthRequestParameters :: UpdateConnectionApiKeyAuthRequestParameters
newUpdateConnectionApiKeyAuthRequestParameters =
  UpdateConnectionApiKeyAuthRequestParameters' :: Maybe Text
-> Maybe Text -> UpdateConnectionApiKeyAuthRequestParameters
UpdateConnectionApiKeyAuthRequestParameters'
    { $sel:apiKeyValue:UpdateConnectionApiKeyAuthRequestParameters' :: Maybe Text
apiKeyValue =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:apiKeyName:UpdateConnectionApiKeyAuthRequestParameters' :: Maybe Text
apiKeyName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The value associated with teh API key to use for authorization.
updateConnectionApiKeyAuthRequestParameters_apiKeyValue :: Lens.Lens' UpdateConnectionApiKeyAuthRequestParameters (Prelude.Maybe Prelude.Text)
updateConnectionApiKeyAuthRequestParameters_apiKeyValue :: (Maybe Text -> f (Maybe Text))
-> UpdateConnectionApiKeyAuthRequestParameters
-> f UpdateConnectionApiKeyAuthRequestParameters
updateConnectionApiKeyAuthRequestParameters_apiKeyValue = (UpdateConnectionApiKeyAuthRequestParameters -> Maybe Text)
-> (UpdateConnectionApiKeyAuthRequestParameters
    -> Maybe Text -> UpdateConnectionApiKeyAuthRequestParameters)
-> Lens
     UpdateConnectionApiKeyAuthRequestParameters
     UpdateConnectionApiKeyAuthRequestParameters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnectionApiKeyAuthRequestParameters' {Maybe Text
apiKeyValue :: Maybe Text
$sel:apiKeyValue:UpdateConnectionApiKeyAuthRequestParameters' :: UpdateConnectionApiKeyAuthRequestParameters -> Maybe Text
apiKeyValue} -> Maybe Text
apiKeyValue) (\s :: UpdateConnectionApiKeyAuthRequestParameters
s@UpdateConnectionApiKeyAuthRequestParameters' {} Maybe Text
a -> UpdateConnectionApiKeyAuthRequestParameters
s {$sel:apiKeyValue:UpdateConnectionApiKeyAuthRequestParameters' :: Maybe Text
apiKeyValue = Maybe Text
a} :: UpdateConnectionApiKeyAuthRequestParameters)

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

instance
  Prelude.Hashable
    UpdateConnectionApiKeyAuthRequestParameters

instance
  Prelude.NFData
    UpdateConnectionApiKeyAuthRequestParameters

instance
  Core.ToJSON
    UpdateConnectionApiKeyAuthRequestParameters
  where
  toJSON :: UpdateConnectionApiKeyAuthRequestParameters -> Value
toJSON
    UpdateConnectionApiKeyAuthRequestParameters' {Maybe Text
apiKeyName :: Maybe Text
apiKeyValue :: Maybe Text
$sel:apiKeyName:UpdateConnectionApiKeyAuthRequestParameters' :: UpdateConnectionApiKeyAuthRequestParameters -> Maybe Text
$sel:apiKeyValue:UpdateConnectionApiKeyAuthRequestParameters' :: UpdateConnectionApiKeyAuthRequestParameters -> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"ApiKeyValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
apiKeyValue,
              (Text
"ApiKeyName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
apiKeyName
            ]
        )