{-# 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 #-}
module Amazonka.ChimeSDKMessaging.Types.Processor where
import Amazonka.ChimeSDKMessaging.Types.FallbackAction
import Amazonka.ChimeSDKMessaging.Types.ProcessorConfiguration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Processor = Processor'
{
Processor -> Sensitive Text
name :: Core.Sensitive Prelude.Text,
Processor -> ProcessorConfiguration
configuration :: ProcessorConfiguration,
Processor -> Natural
executionOrder :: Prelude.Natural,
Processor -> FallbackAction
fallbackAction :: FallbackAction
}
deriving (Processor -> Processor -> Bool
(Processor -> Processor -> Bool)
-> (Processor -> Processor -> Bool) -> Eq Processor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Processor -> Processor -> Bool
$c/= :: Processor -> Processor -> Bool
== :: Processor -> Processor -> Bool
$c== :: Processor -> Processor -> Bool
Prelude.Eq, Int -> Processor -> ShowS
[Processor] -> ShowS
Processor -> String
(Int -> Processor -> ShowS)
-> (Processor -> String)
-> ([Processor] -> ShowS)
-> Show Processor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Processor] -> ShowS
$cshowList :: [Processor] -> ShowS
show :: Processor -> String
$cshow :: Processor -> String
showsPrec :: Int -> Processor -> ShowS
$cshowsPrec :: Int -> Processor -> ShowS
Prelude.Show, (forall x. Processor -> Rep Processor x)
-> (forall x. Rep Processor x -> Processor) -> Generic Processor
forall x. Rep Processor x -> Processor
forall x. Processor -> Rep Processor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Processor x -> Processor
$cfrom :: forall x. Processor -> Rep Processor x
Prelude.Generic)
newProcessor ::
Prelude.Text ->
ProcessorConfiguration ->
Prelude.Natural ->
FallbackAction ->
Processor
newProcessor :: Text
-> ProcessorConfiguration -> Natural -> FallbackAction -> Processor
newProcessor
Text
pName_
ProcessorConfiguration
pConfiguration_
Natural
pExecutionOrder_
FallbackAction
pFallbackAction_ =
Processor' :: Sensitive Text
-> ProcessorConfiguration -> Natural -> FallbackAction -> Processor
Processor'
{ $sel:name:Processor' :: Sensitive Text
name = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pName_,
$sel:configuration:Processor' :: ProcessorConfiguration
configuration = ProcessorConfiguration
pConfiguration_,
$sel:executionOrder:Processor' :: Natural
executionOrder = Natural
pExecutionOrder_,
$sel:fallbackAction:Processor' :: FallbackAction
fallbackAction = FallbackAction
pFallbackAction_
}
processor_name :: Lens.Lens' Processor Prelude.Text
processor_name :: (Text -> f Text) -> Processor -> f Processor
processor_name = (Processor -> Sensitive Text)
-> (Processor -> Sensitive Text -> Processor)
-> Lens Processor Processor (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Processor' {Sensitive Text
name :: Sensitive Text
$sel:name:Processor' :: Processor -> Sensitive Text
name} -> Sensitive Text
name) (\s :: Processor
s@Processor' {} Sensitive Text
a -> Processor
s {$sel:name:Processor' :: Sensitive Text
name = Sensitive Text
a} :: Processor) ((Sensitive Text -> f (Sensitive Text))
-> Processor -> f Processor)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> Processor
-> f Processor
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
processor_configuration :: Lens.Lens' Processor ProcessorConfiguration
processor_configuration :: (ProcessorConfiguration -> f ProcessorConfiguration)
-> Processor -> f Processor
processor_configuration = (Processor -> ProcessorConfiguration)
-> (Processor -> ProcessorConfiguration -> Processor)
-> Lens
Processor Processor ProcessorConfiguration ProcessorConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Processor' {ProcessorConfiguration
configuration :: ProcessorConfiguration
$sel:configuration:Processor' :: Processor -> ProcessorConfiguration
configuration} -> ProcessorConfiguration
configuration) (\s :: Processor
s@Processor' {} ProcessorConfiguration
a -> Processor
s {$sel:configuration:Processor' :: ProcessorConfiguration
configuration = ProcessorConfiguration
a} :: Processor)
processor_executionOrder :: Lens.Lens' Processor Prelude.Natural
processor_executionOrder :: (Natural -> f Natural) -> Processor -> f Processor
processor_executionOrder = (Processor -> Natural)
-> (Processor -> Natural -> Processor)
-> Lens Processor Processor Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Processor' {Natural
executionOrder :: Natural
$sel:executionOrder:Processor' :: Processor -> Natural
executionOrder} -> Natural
executionOrder) (\s :: Processor
s@Processor' {} Natural
a -> Processor
s {$sel:executionOrder:Processor' :: Natural
executionOrder = Natural
a} :: Processor)
processor_fallbackAction :: Lens.Lens' Processor FallbackAction
processor_fallbackAction :: (FallbackAction -> f FallbackAction) -> Processor -> f Processor
processor_fallbackAction = (Processor -> FallbackAction)
-> (Processor -> FallbackAction -> Processor)
-> Lens Processor Processor FallbackAction FallbackAction
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Processor' {FallbackAction
fallbackAction :: FallbackAction
$sel:fallbackAction:Processor' :: Processor -> FallbackAction
fallbackAction} -> FallbackAction
fallbackAction) (\s :: Processor
s@Processor' {} FallbackAction
a -> Processor
s {$sel:fallbackAction:Processor' :: FallbackAction
fallbackAction = FallbackAction
a} :: Processor)
instance Core.FromJSON Processor where
parseJSON :: Value -> Parser Processor
parseJSON =
String -> (Object -> Parser Processor) -> Value -> Parser Processor
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Processor"
( \Object
x ->
Sensitive Text
-> ProcessorConfiguration -> Natural -> FallbackAction -> Processor
Processor'
(Sensitive Text
-> ProcessorConfiguration
-> Natural
-> FallbackAction
-> Processor)
-> Parser (Sensitive Text)
-> Parser
(ProcessorConfiguration -> Natural -> FallbackAction -> Processor)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Sensitive Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
Parser
(ProcessorConfiguration -> Natural -> FallbackAction -> Processor)
-> Parser ProcessorConfiguration
-> Parser (Natural -> FallbackAction -> Processor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ProcessorConfiguration
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Configuration")
Parser (Natural -> FallbackAction -> Processor)
-> Parser Natural -> Parser (FallbackAction -> Processor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ExecutionOrder")
Parser (FallbackAction -> Processor)
-> Parser FallbackAction -> Parser Processor
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FallbackAction
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"FallbackAction")
)
instance Prelude.Hashable Processor
instance Prelude.NFData Processor
instance Core.ToJSON Processor where
toJSON :: Processor -> Value
toJSON Processor' {Natural
Sensitive Text
FallbackAction
ProcessorConfiguration
fallbackAction :: FallbackAction
executionOrder :: Natural
configuration :: ProcessorConfiguration
name :: Sensitive Text
$sel:fallbackAction:Processor' :: Processor -> FallbackAction
$sel:executionOrder:Processor' :: Processor -> Natural
$sel:configuration:Processor' :: Processor -> ProcessorConfiguration
$sel:name:Processor' :: Processor -> Sensitive 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
"Name" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Configuration" Text -> ProcessorConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ProcessorConfiguration
configuration),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ExecutionOrder" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
executionOrder),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"FallbackAction" Text -> FallbackAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FallbackAction
fallbackAction)
]
)