{-# 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.AppSync.Types.LambdaConflictHandlerConfig
-- 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.AppSync.Types.LambdaConflictHandlerConfig where

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

-- | The @LambdaConflictHandlerConfig@ object when configuring LAMBDA as the
-- Conflict Handler.
--
-- /See:/ 'newLambdaConflictHandlerConfig' smart constructor.
data LambdaConflictHandlerConfig = LambdaConflictHandlerConfig'
  { -- | The Arn for the Lambda function to use as the Conflict Handler.
    LambdaConflictHandlerConfig -> Maybe Text
lambdaConflictHandlerArn :: Prelude.Maybe Prelude.Text
  }
  deriving (LambdaConflictHandlerConfig -> LambdaConflictHandlerConfig -> Bool
(LambdaConflictHandlerConfig
 -> LambdaConflictHandlerConfig -> Bool)
-> (LambdaConflictHandlerConfig
    -> LambdaConflictHandlerConfig -> Bool)
-> Eq LambdaConflictHandlerConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaConflictHandlerConfig -> LambdaConflictHandlerConfig -> Bool
$c/= :: LambdaConflictHandlerConfig -> LambdaConflictHandlerConfig -> Bool
== :: LambdaConflictHandlerConfig -> LambdaConflictHandlerConfig -> Bool
$c== :: LambdaConflictHandlerConfig -> LambdaConflictHandlerConfig -> Bool
Prelude.Eq, ReadPrec [LambdaConflictHandlerConfig]
ReadPrec LambdaConflictHandlerConfig
Int -> ReadS LambdaConflictHandlerConfig
ReadS [LambdaConflictHandlerConfig]
(Int -> ReadS LambdaConflictHandlerConfig)
-> ReadS [LambdaConflictHandlerConfig]
-> ReadPrec LambdaConflictHandlerConfig
-> ReadPrec [LambdaConflictHandlerConfig]
-> Read LambdaConflictHandlerConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaConflictHandlerConfig]
$creadListPrec :: ReadPrec [LambdaConflictHandlerConfig]
readPrec :: ReadPrec LambdaConflictHandlerConfig
$creadPrec :: ReadPrec LambdaConflictHandlerConfig
readList :: ReadS [LambdaConflictHandlerConfig]
$creadList :: ReadS [LambdaConflictHandlerConfig]
readsPrec :: Int -> ReadS LambdaConflictHandlerConfig
$creadsPrec :: Int -> ReadS LambdaConflictHandlerConfig
Prelude.Read, Int -> LambdaConflictHandlerConfig -> ShowS
[LambdaConflictHandlerConfig] -> ShowS
LambdaConflictHandlerConfig -> String
(Int -> LambdaConflictHandlerConfig -> ShowS)
-> (LambdaConflictHandlerConfig -> String)
-> ([LambdaConflictHandlerConfig] -> ShowS)
-> Show LambdaConflictHandlerConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaConflictHandlerConfig] -> ShowS
$cshowList :: [LambdaConflictHandlerConfig] -> ShowS
show :: LambdaConflictHandlerConfig -> String
$cshow :: LambdaConflictHandlerConfig -> String
showsPrec :: Int -> LambdaConflictHandlerConfig -> ShowS
$cshowsPrec :: Int -> LambdaConflictHandlerConfig -> ShowS
Prelude.Show, (forall x.
 LambdaConflictHandlerConfig -> Rep LambdaConflictHandlerConfig x)
-> (forall x.
    Rep LambdaConflictHandlerConfig x -> LambdaConflictHandlerConfig)
-> Generic LambdaConflictHandlerConfig
forall x.
Rep LambdaConflictHandlerConfig x -> LambdaConflictHandlerConfig
forall x.
LambdaConflictHandlerConfig -> Rep LambdaConflictHandlerConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaConflictHandlerConfig x -> LambdaConflictHandlerConfig
$cfrom :: forall x.
LambdaConflictHandlerConfig -> Rep LambdaConflictHandlerConfig x
Prelude.Generic)

-- |
-- Create a value of 'LambdaConflictHandlerConfig' 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:
--
-- 'lambdaConflictHandlerArn', 'lambdaConflictHandlerConfig_lambdaConflictHandlerArn' - The Arn for the Lambda function to use as the Conflict Handler.
newLambdaConflictHandlerConfig ::
  LambdaConflictHandlerConfig
newLambdaConflictHandlerConfig :: LambdaConflictHandlerConfig
newLambdaConflictHandlerConfig =
  LambdaConflictHandlerConfig' :: Maybe Text -> LambdaConflictHandlerConfig
LambdaConflictHandlerConfig'
    { $sel:lambdaConflictHandlerArn:LambdaConflictHandlerConfig' :: Maybe Text
lambdaConflictHandlerArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Arn for the Lambda function to use as the Conflict Handler.
lambdaConflictHandlerConfig_lambdaConflictHandlerArn :: Lens.Lens' LambdaConflictHandlerConfig (Prelude.Maybe Prelude.Text)
lambdaConflictHandlerConfig_lambdaConflictHandlerArn :: (Maybe Text -> f (Maybe Text))
-> LambdaConflictHandlerConfig -> f LambdaConflictHandlerConfig
lambdaConflictHandlerConfig_lambdaConflictHandlerArn = (LambdaConflictHandlerConfig -> Maybe Text)
-> (LambdaConflictHandlerConfig
    -> Maybe Text -> LambdaConflictHandlerConfig)
-> Lens
     LambdaConflictHandlerConfig
     LambdaConflictHandlerConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaConflictHandlerConfig' {Maybe Text
lambdaConflictHandlerArn :: Maybe Text
$sel:lambdaConflictHandlerArn:LambdaConflictHandlerConfig' :: LambdaConflictHandlerConfig -> Maybe Text
lambdaConflictHandlerArn} -> Maybe Text
lambdaConflictHandlerArn) (\s :: LambdaConflictHandlerConfig
s@LambdaConflictHandlerConfig' {} Maybe Text
a -> LambdaConflictHandlerConfig
s {$sel:lambdaConflictHandlerArn:LambdaConflictHandlerConfig' :: Maybe Text
lambdaConflictHandlerArn = Maybe Text
a} :: LambdaConflictHandlerConfig)

instance Core.FromJSON LambdaConflictHandlerConfig where
  parseJSON :: Value -> Parser LambdaConflictHandlerConfig
parseJSON =
    String
-> (Object -> Parser LambdaConflictHandlerConfig)
-> Value
-> Parser LambdaConflictHandlerConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LambdaConflictHandlerConfig"
      ( \Object
x ->
          Maybe Text -> LambdaConflictHandlerConfig
LambdaConflictHandlerConfig'
            (Maybe Text -> LambdaConflictHandlerConfig)
-> Parser (Maybe Text) -> Parser LambdaConflictHandlerConfig
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
"lambdaConflictHandlerArn")
      )

instance Prelude.Hashable LambdaConflictHandlerConfig

instance Prelude.NFData LambdaConflictHandlerConfig

instance Core.ToJSON LambdaConflictHandlerConfig where
  toJSON :: LambdaConflictHandlerConfig -> Value
toJSON LambdaConflictHandlerConfig' {Maybe Text
lambdaConflictHandlerArn :: Maybe Text
$sel:lambdaConflictHandlerArn:LambdaConflictHandlerConfig' :: LambdaConflictHandlerConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"lambdaConflictHandlerArn" 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
lambdaConflictHandlerArn
          ]
      )