{-# 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.PinpointSmsVoiceV2.Types.EventDestination where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.PinpointSmsVoiceV2.Types.CloudWatchLogsDestination
import Amazonka.PinpointSmsVoiceV2.Types.EventType
import Amazonka.PinpointSmsVoiceV2.Types.KinesisFirehoseDestination
import Amazonka.PinpointSmsVoiceV2.Types.SnsDestination
import qualified Amazonka.Prelude as Prelude
data EventDestination = EventDestination'
{
EventDestination -> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination :: Prelude.Maybe CloudWatchLogsDestination,
EventDestination -> Maybe KinesisFirehoseDestination
kinesisFirehoseDestination :: Prelude.Maybe KinesisFirehoseDestination,
EventDestination -> Maybe SnsDestination
snsDestination :: Prelude.Maybe SnsDestination,
EventDestination -> Text
eventDestinationName :: Prelude.Text,
EventDestination -> Bool
enabled :: Prelude.Bool,
EventDestination -> NonEmpty EventType
matchingEventTypes :: Prelude.NonEmpty EventType
}
deriving (EventDestination -> EventDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventDestination -> EventDestination -> Bool
$c/= :: EventDestination -> EventDestination -> Bool
== :: EventDestination -> EventDestination -> Bool
$c== :: EventDestination -> EventDestination -> Bool
Prelude.Eq, ReadPrec [EventDestination]
ReadPrec EventDestination
Int -> ReadS EventDestination
ReadS [EventDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventDestination]
$creadListPrec :: ReadPrec [EventDestination]
readPrec :: ReadPrec EventDestination
$creadPrec :: ReadPrec EventDestination
readList :: ReadS [EventDestination]
$creadList :: ReadS [EventDestination]
readsPrec :: Int -> ReadS EventDestination
$creadsPrec :: Int -> ReadS EventDestination
Prelude.Read, Int -> EventDestination -> ShowS
[EventDestination] -> ShowS
EventDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventDestination] -> ShowS
$cshowList :: [EventDestination] -> ShowS
show :: EventDestination -> String
$cshow :: EventDestination -> String
showsPrec :: Int -> EventDestination -> ShowS
$cshowsPrec :: Int -> EventDestination -> ShowS
Prelude.Show, forall x. Rep EventDestination x -> EventDestination
forall x. EventDestination -> Rep EventDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventDestination x -> EventDestination
$cfrom :: forall x. EventDestination -> Rep EventDestination x
Prelude.Generic)
newEventDestination ::
Prelude.Text ->
Prelude.Bool ->
Prelude.NonEmpty EventType ->
EventDestination
newEventDestination :: Text -> Bool -> NonEmpty EventType -> EventDestination
newEventDestination
Text
pEventDestinationName_
Bool
pEnabled_
NonEmpty EventType
pMatchingEventTypes_ =
EventDestination'
{ $sel:cloudWatchLogsDestination:EventDestination' :: Maybe CloudWatchLogsDestination
cloudWatchLogsDestination =
forall a. Maybe a
Prelude.Nothing,
$sel:kinesisFirehoseDestination:EventDestination' :: Maybe KinesisFirehoseDestination
kinesisFirehoseDestination = forall a. Maybe a
Prelude.Nothing,
$sel:snsDestination:EventDestination' :: Maybe SnsDestination
snsDestination = forall a. Maybe a
Prelude.Nothing,
$sel:eventDestinationName:EventDestination' :: Text
eventDestinationName = Text
pEventDestinationName_,
$sel:enabled:EventDestination' :: Bool
enabled = Bool
pEnabled_,
$sel:matchingEventTypes:EventDestination' :: NonEmpty EventType
matchingEventTypes =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty EventType
pMatchingEventTypes_
}
eventDestination_cloudWatchLogsDestination :: Lens.Lens' EventDestination (Prelude.Maybe CloudWatchLogsDestination)
eventDestination_cloudWatchLogsDestination :: Lens' EventDestination (Maybe CloudWatchLogsDestination)
eventDestination_cloudWatchLogsDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestination' {Maybe CloudWatchLogsDestination
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:cloudWatchLogsDestination:EventDestination' :: EventDestination -> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination} -> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination) (\s :: EventDestination
s@EventDestination' {} Maybe CloudWatchLogsDestination
a -> EventDestination
s {$sel:cloudWatchLogsDestination:EventDestination' :: Maybe CloudWatchLogsDestination
cloudWatchLogsDestination = Maybe CloudWatchLogsDestination
a} :: EventDestination)
eventDestination_kinesisFirehoseDestination :: Lens.Lens' EventDestination (Prelude.Maybe KinesisFirehoseDestination)
eventDestination_kinesisFirehoseDestination :: Lens' EventDestination (Maybe KinesisFirehoseDestination)
eventDestination_kinesisFirehoseDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestination' {Maybe KinesisFirehoseDestination
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
$sel:kinesisFirehoseDestination:EventDestination' :: EventDestination -> Maybe KinesisFirehoseDestination
kinesisFirehoseDestination} -> Maybe KinesisFirehoseDestination
kinesisFirehoseDestination) (\s :: EventDestination
s@EventDestination' {} Maybe KinesisFirehoseDestination
a -> EventDestination
s {$sel:kinesisFirehoseDestination:EventDestination' :: Maybe KinesisFirehoseDestination
kinesisFirehoseDestination = Maybe KinesisFirehoseDestination
a} :: EventDestination)
eventDestination_snsDestination :: Lens.Lens' EventDestination (Prelude.Maybe SnsDestination)
eventDestination_snsDestination :: Lens' EventDestination (Maybe SnsDestination)
eventDestination_snsDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestination' {Maybe SnsDestination
snsDestination :: Maybe SnsDestination
$sel:snsDestination:EventDestination' :: EventDestination -> Maybe SnsDestination
snsDestination} -> Maybe SnsDestination
snsDestination) (\s :: EventDestination
s@EventDestination' {} Maybe SnsDestination
a -> EventDestination
s {$sel:snsDestination:EventDestination' :: Maybe SnsDestination
snsDestination = Maybe SnsDestination
a} :: EventDestination)
eventDestination_eventDestinationName :: Lens.Lens' EventDestination Prelude.Text
eventDestination_eventDestinationName :: Lens' EventDestination Text
eventDestination_eventDestinationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestination' {Text
eventDestinationName :: Text
$sel:eventDestinationName:EventDestination' :: EventDestination -> Text
eventDestinationName} -> Text
eventDestinationName) (\s :: EventDestination
s@EventDestination' {} Text
a -> EventDestination
s {$sel:eventDestinationName:EventDestination' :: Text
eventDestinationName = Text
a} :: EventDestination)
eventDestination_enabled :: Lens.Lens' EventDestination Prelude.Bool
eventDestination_enabled :: Lens' EventDestination Bool
eventDestination_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestination' {Bool
enabled :: Bool
$sel:enabled:EventDestination' :: EventDestination -> Bool
enabled} -> Bool
enabled) (\s :: EventDestination
s@EventDestination' {} Bool
a -> EventDestination
s {$sel:enabled:EventDestination' :: Bool
enabled = Bool
a} :: EventDestination)
eventDestination_matchingEventTypes :: Lens.Lens' EventDestination (Prelude.NonEmpty EventType)
eventDestination_matchingEventTypes :: Lens' EventDestination (NonEmpty EventType)
eventDestination_matchingEventTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestination' {NonEmpty EventType
matchingEventTypes :: NonEmpty EventType
$sel:matchingEventTypes:EventDestination' :: EventDestination -> NonEmpty EventType
matchingEventTypes} -> NonEmpty EventType
matchingEventTypes) (\s :: EventDestination
s@EventDestination' {} NonEmpty EventType
a -> EventDestination
s {$sel:matchingEventTypes:EventDestination' :: NonEmpty EventType
matchingEventTypes = NonEmpty EventType
a} :: EventDestination) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON EventDestination where
parseJSON :: Value -> Parser EventDestination
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EventDestination"
( \Object
x ->
Maybe CloudWatchLogsDestination
-> Maybe KinesisFirehoseDestination
-> Maybe SnsDestination
-> Text
-> Bool
-> NonEmpty EventType
-> EventDestination
EventDestination'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CloudWatchLogsDestination")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"KinesisFirehoseDestination")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SnsDestination")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"EventDestinationName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Enabled")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"MatchingEventTypes")
)
instance Prelude.Hashable EventDestination where
hashWithSalt :: Int -> EventDestination -> Int
hashWithSalt Int
_salt EventDestination' {Bool
Maybe CloudWatchLogsDestination
Maybe KinesisFirehoseDestination
Maybe SnsDestination
NonEmpty EventType
Text
matchingEventTypes :: NonEmpty EventType
enabled :: Bool
eventDestinationName :: Text
snsDestination :: Maybe SnsDestination
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:matchingEventTypes:EventDestination' :: EventDestination -> NonEmpty EventType
$sel:enabled:EventDestination' :: EventDestination -> Bool
$sel:eventDestinationName:EventDestination' :: EventDestination -> Text
$sel:snsDestination:EventDestination' :: EventDestination -> Maybe SnsDestination
$sel:kinesisFirehoseDestination:EventDestination' :: EventDestination -> Maybe KinesisFirehoseDestination
$sel:cloudWatchLogsDestination:EventDestination' :: EventDestination -> Maybe CloudWatchLogsDestination
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudWatchLogsDestination
cloudWatchLogsDestination
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KinesisFirehoseDestination
kinesisFirehoseDestination
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SnsDestination
snsDestination
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
eventDestinationName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
enabled
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty EventType
matchingEventTypes
instance Prelude.NFData EventDestination where
rnf :: EventDestination -> ()
rnf EventDestination' {Bool
Maybe CloudWatchLogsDestination
Maybe KinesisFirehoseDestination
Maybe SnsDestination
NonEmpty EventType
Text
matchingEventTypes :: NonEmpty EventType
enabled :: Bool
eventDestinationName :: Text
snsDestination :: Maybe SnsDestination
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:matchingEventTypes:EventDestination' :: EventDestination -> NonEmpty EventType
$sel:enabled:EventDestination' :: EventDestination -> Bool
$sel:eventDestinationName:EventDestination' :: EventDestination -> Text
$sel:snsDestination:EventDestination' :: EventDestination -> Maybe SnsDestination
$sel:kinesisFirehoseDestination:EventDestination' :: EventDestination -> Maybe KinesisFirehoseDestination
$sel:cloudWatchLogsDestination:EventDestination' :: EventDestination -> Maybe CloudWatchLogsDestination
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CloudWatchLogsDestination
cloudWatchLogsDestination
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KinesisFirehoseDestination
kinesisFirehoseDestination
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SnsDestination
snsDestination
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
eventDestinationName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
enabled
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty EventType
matchingEventTypes