{-# 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.ChimeSDKMessaging.Types.ProcessorConfiguration
-- 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.ChimeSDKMessaging.Types.ProcessorConfiguration where

import Amazonka.ChimeSDKMessaging.Types.LambdaConfiguration
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

-- | A processor\'s metadata.
--
-- /See:/ 'newProcessorConfiguration' smart constructor.
data ProcessorConfiguration = ProcessorConfiguration'
  { -- | Indicates that the processor is of type Lambda.
    ProcessorConfiguration -> LambdaConfiguration
lambda :: LambdaConfiguration
  }
  deriving (ProcessorConfiguration -> ProcessorConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProcessorConfiguration -> ProcessorConfiguration -> Bool
$c/= :: ProcessorConfiguration -> ProcessorConfiguration -> Bool
== :: ProcessorConfiguration -> ProcessorConfiguration -> Bool
$c== :: ProcessorConfiguration -> ProcessorConfiguration -> Bool
Prelude.Eq, ReadPrec [ProcessorConfiguration]
ReadPrec ProcessorConfiguration
Int -> ReadS ProcessorConfiguration
ReadS [ProcessorConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProcessorConfiguration]
$creadListPrec :: ReadPrec [ProcessorConfiguration]
readPrec :: ReadPrec ProcessorConfiguration
$creadPrec :: ReadPrec ProcessorConfiguration
readList :: ReadS [ProcessorConfiguration]
$creadList :: ReadS [ProcessorConfiguration]
readsPrec :: Int -> ReadS ProcessorConfiguration
$creadsPrec :: Int -> ReadS ProcessorConfiguration
Prelude.Read, Int -> ProcessorConfiguration -> ShowS
[ProcessorConfiguration] -> ShowS
ProcessorConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProcessorConfiguration] -> ShowS
$cshowList :: [ProcessorConfiguration] -> ShowS
show :: ProcessorConfiguration -> String
$cshow :: ProcessorConfiguration -> String
showsPrec :: Int -> ProcessorConfiguration -> ShowS
$cshowsPrec :: Int -> ProcessorConfiguration -> ShowS
Prelude.Show, forall x. Rep ProcessorConfiguration x -> ProcessorConfiguration
forall x. ProcessorConfiguration -> Rep ProcessorConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProcessorConfiguration x -> ProcessorConfiguration
$cfrom :: forall x. ProcessorConfiguration -> Rep ProcessorConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ProcessorConfiguration' 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:
--
-- 'lambda', 'processorConfiguration_lambda' - Indicates that the processor is of type Lambda.
newProcessorConfiguration ::
  -- | 'lambda'
  LambdaConfiguration ->
  ProcessorConfiguration
newProcessorConfiguration :: LambdaConfiguration -> ProcessorConfiguration
newProcessorConfiguration LambdaConfiguration
pLambda_ =
  ProcessorConfiguration' {$sel:lambda:ProcessorConfiguration' :: LambdaConfiguration
lambda = LambdaConfiguration
pLambda_}

-- | Indicates that the processor is of type Lambda.
processorConfiguration_lambda :: Lens.Lens' ProcessorConfiguration LambdaConfiguration
processorConfiguration_lambda :: Lens' ProcessorConfiguration LambdaConfiguration
processorConfiguration_lambda = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessorConfiguration' {LambdaConfiguration
lambda :: LambdaConfiguration
$sel:lambda:ProcessorConfiguration' :: ProcessorConfiguration -> LambdaConfiguration
lambda} -> LambdaConfiguration
lambda) (\s :: ProcessorConfiguration
s@ProcessorConfiguration' {} LambdaConfiguration
a -> ProcessorConfiguration
s {$sel:lambda:ProcessorConfiguration' :: LambdaConfiguration
lambda = LambdaConfiguration
a} :: ProcessorConfiguration)

instance Data.FromJSON ProcessorConfiguration where
  parseJSON :: Value -> Parser ProcessorConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProcessorConfiguration"
      ( \Object
x ->
          LambdaConfiguration -> ProcessorConfiguration
ProcessorConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Lambda")
      )

instance Prelude.Hashable ProcessorConfiguration where
  hashWithSalt :: Int -> ProcessorConfiguration -> Int
hashWithSalt Int
_salt ProcessorConfiguration' {LambdaConfiguration
lambda :: LambdaConfiguration
$sel:lambda:ProcessorConfiguration' :: ProcessorConfiguration -> LambdaConfiguration
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LambdaConfiguration
lambda

instance Prelude.NFData ProcessorConfiguration where
  rnf :: ProcessorConfiguration -> ()
rnf ProcessorConfiguration' {LambdaConfiguration
lambda :: LambdaConfiguration
$sel:lambda:ProcessorConfiguration' :: ProcessorConfiguration -> LambdaConfiguration
..} = forall a. NFData a => a -> ()
Prelude.rnf LambdaConfiguration
lambda

instance Data.ToJSON ProcessorConfiguration where
  toJSON :: ProcessorConfiguration -> Value
toJSON ProcessorConfiguration' {LambdaConfiguration
lambda :: LambdaConfiguration
$sel:lambda:ProcessorConfiguration' :: ProcessorConfiguration -> LambdaConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Lambda" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LambdaConfiguration
lambda)]
      )