{-# 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.SmsVoice.Types.EventDestinationDefinition
-- 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.SmsVoice.Types.EventDestinationDefinition where

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
import Amazonka.SmsVoice.Types.CloudWatchLogsDestination
import Amazonka.SmsVoice.Types.EventType
import Amazonka.SmsVoice.Types.KinesisFirehoseDestination
import Amazonka.SmsVoice.Types.SnsDestination

-- | An object that defines a single event destination.
--
-- /See:/ 'newEventDestinationDefinition' smart constructor.
data EventDestinationDefinition = EventDestinationDefinition'
  { EventDestinationDefinition -> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination :: Prelude.Maybe CloudWatchLogsDestination,
    -- | Indicates whether or not the event destination is enabled. If the event
    -- destination is enabled, then Amazon Pinpoint sends response data to the
    -- specified event destination.
    EventDestinationDefinition -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    EventDestinationDefinition -> Maybe KinesisFirehoseDestination
kinesisFirehoseDestination :: Prelude.Maybe KinesisFirehoseDestination,
    EventDestinationDefinition -> Maybe [EventType]
matchingEventTypes :: Prelude.Maybe [EventType],
    EventDestinationDefinition -> Maybe SnsDestination
snsDestination :: Prelude.Maybe SnsDestination
  }
  deriving (EventDestinationDefinition -> EventDestinationDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventDestinationDefinition -> EventDestinationDefinition -> Bool
$c/= :: EventDestinationDefinition -> EventDestinationDefinition -> Bool
== :: EventDestinationDefinition -> EventDestinationDefinition -> Bool
$c== :: EventDestinationDefinition -> EventDestinationDefinition -> Bool
Prelude.Eq, ReadPrec [EventDestinationDefinition]
ReadPrec EventDestinationDefinition
Int -> ReadS EventDestinationDefinition
ReadS [EventDestinationDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventDestinationDefinition]
$creadListPrec :: ReadPrec [EventDestinationDefinition]
readPrec :: ReadPrec EventDestinationDefinition
$creadPrec :: ReadPrec EventDestinationDefinition
readList :: ReadS [EventDestinationDefinition]
$creadList :: ReadS [EventDestinationDefinition]
readsPrec :: Int -> ReadS EventDestinationDefinition
$creadsPrec :: Int -> ReadS EventDestinationDefinition
Prelude.Read, Int -> EventDestinationDefinition -> ShowS
[EventDestinationDefinition] -> ShowS
EventDestinationDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventDestinationDefinition] -> ShowS
$cshowList :: [EventDestinationDefinition] -> ShowS
show :: EventDestinationDefinition -> String
$cshow :: EventDestinationDefinition -> String
showsPrec :: Int -> EventDestinationDefinition -> ShowS
$cshowsPrec :: Int -> EventDestinationDefinition -> ShowS
Prelude.Show, forall x.
Rep EventDestinationDefinition x -> EventDestinationDefinition
forall x.
EventDestinationDefinition -> Rep EventDestinationDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EventDestinationDefinition x -> EventDestinationDefinition
$cfrom :: forall x.
EventDestinationDefinition -> Rep EventDestinationDefinition x
Prelude.Generic)

-- |
-- Create a value of 'EventDestinationDefinition' 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:
--
-- 'cloudWatchLogsDestination', 'eventDestinationDefinition_cloudWatchLogsDestination' - Undocumented member.
--
-- 'enabled', 'eventDestinationDefinition_enabled' - Indicates whether or not the event destination is enabled. If the event
-- destination is enabled, then Amazon Pinpoint sends response data to the
-- specified event destination.
--
-- 'kinesisFirehoseDestination', 'eventDestinationDefinition_kinesisFirehoseDestination' - Undocumented member.
--
-- 'matchingEventTypes', 'eventDestinationDefinition_matchingEventTypes' - Undocumented member.
--
-- 'snsDestination', 'eventDestinationDefinition_snsDestination' - Undocumented member.
newEventDestinationDefinition ::
  EventDestinationDefinition
newEventDestinationDefinition :: EventDestinationDefinition
newEventDestinationDefinition =
  EventDestinationDefinition'
    { $sel:cloudWatchLogsDestination:EventDestinationDefinition' :: Maybe CloudWatchLogsDestination
cloudWatchLogsDestination =
        forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:EventDestinationDefinition' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
      $sel:kinesisFirehoseDestination:EventDestinationDefinition' :: Maybe KinesisFirehoseDestination
kinesisFirehoseDestination = forall a. Maybe a
Prelude.Nothing,
      $sel:matchingEventTypes:EventDestinationDefinition' :: Maybe [EventType]
matchingEventTypes = forall a. Maybe a
Prelude.Nothing,
      $sel:snsDestination:EventDestinationDefinition' :: Maybe SnsDestination
snsDestination = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
eventDestinationDefinition_cloudWatchLogsDestination :: Lens.Lens' EventDestinationDefinition (Prelude.Maybe CloudWatchLogsDestination)
eventDestinationDefinition_cloudWatchLogsDestination :: Lens' EventDestinationDefinition (Maybe CloudWatchLogsDestination)
eventDestinationDefinition_cloudWatchLogsDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestinationDefinition' {Maybe CloudWatchLogsDestination
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:cloudWatchLogsDestination:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination} -> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination) (\s :: EventDestinationDefinition
s@EventDestinationDefinition' {} Maybe CloudWatchLogsDestination
a -> EventDestinationDefinition
s {$sel:cloudWatchLogsDestination:EventDestinationDefinition' :: Maybe CloudWatchLogsDestination
cloudWatchLogsDestination = Maybe CloudWatchLogsDestination
a} :: EventDestinationDefinition)

-- | Indicates whether or not the event destination is enabled. If the event
-- destination is enabled, then Amazon Pinpoint sends response data to the
-- specified event destination.
eventDestinationDefinition_enabled :: Lens.Lens' EventDestinationDefinition (Prelude.Maybe Prelude.Bool)
eventDestinationDefinition_enabled :: Lens' EventDestinationDefinition (Maybe Bool)
eventDestinationDefinition_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestinationDefinition' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: EventDestinationDefinition
s@EventDestinationDefinition' {} Maybe Bool
a -> EventDestinationDefinition
s {$sel:enabled:EventDestinationDefinition' :: Maybe Bool
enabled = Maybe Bool
a} :: EventDestinationDefinition)

-- | Undocumented member.
eventDestinationDefinition_kinesisFirehoseDestination :: Lens.Lens' EventDestinationDefinition (Prelude.Maybe KinesisFirehoseDestination)
eventDestinationDefinition_kinesisFirehoseDestination :: Lens' EventDestinationDefinition (Maybe KinesisFirehoseDestination)
eventDestinationDefinition_kinesisFirehoseDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestinationDefinition' {Maybe KinesisFirehoseDestination
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
$sel:kinesisFirehoseDestination:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe KinesisFirehoseDestination
kinesisFirehoseDestination} -> Maybe KinesisFirehoseDestination
kinesisFirehoseDestination) (\s :: EventDestinationDefinition
s@EventDestinationDefinition' {} Maybe KinesisFirehoseDestination
a -> EventDestinationDefinition
s {$sel:kinesisFirehoseDestination:EventDestinationDefinition' :: Maybe KinesisFirehoseDestination
kinesisFirehoseDestination = Maybe KinesisFirehoseDestination
a} :: EventDestinationDefinition)

-- | Undocumented member.
eventDestinationDefinition_matchingEventTypes :: Lens.Lens' EventDestinationDefinition (Prelude.Maybe [EventType])
eventDestinationDefinition_matchingEventTypes :: Lens' EventDestinationDefinition (Maybe [EventType])
eventDestinationDefinition_matchingEventTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestinationDefinition' {Maybe [EventType]
matchingEventTypes :: Maybe [EventType]
$sel:matchingEventTypes:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe [EventType]
matchingEventTypes} -> Maybe [EventType]
matchingEventTypes) (\s :: EventDestinationDefinition
s@EventDestinationDefinition' {} Maybe [EventType]
a -> EventDestinationDefinition
s {$sel:matchingEventTypes:EventDestinationDefinition' :: Maybe [EventType]
matchingEventTypes = Maybe [EventType]
a} :: EventDestinationDefinition) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
eventDestinationDefinition_snsDestination :: Lens.Lens' EventDestinationDefinition (Prelude.Maybe SnsDestination)
eventDestinationDefinition_snsDestination :: Lens' EventDestinationDefinition (Maybe SnsDestination)
eventDestinationDefinition_snsDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventDestinationDefinition' {Maybe SnsDestination
snsDestination :: Maybe SnsDestination
$sel:snsDestination:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe SnsDestination
snsDestination} -> Maybe SnsDestination
snsDestination) (\s :: EventDestinationDefinition
s@EventDestinationDefinition' {} Maybe SnsDestination
a -> EventDestinationDefinition
s {$sel:snsDestination:EventDestinationDefinition' :: Maybe SnsDestination
snsDestination = Maybe SnsDestination
a} :: EventDestinationDefinition)

instance Prelude.Hashable EventDestinationDefinition where
  hashWithSalt :: Int -> EventDestinationDefinition -> Int
hashWithSalt Int
_salt EventDestinationDefinition' {Maybe Bool
Maybe [EventType]
Maybe CloudWatchLogsDestination
Maybe KinesisFirehoseDestination
Maybe SnsDestination
snsDestination :: Maybe SnsDestination
matchingEventTypes :: Maybe [EventType]
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
enabled :: Maybe Bool
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:snsDestination:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe SnsDestination
$sel:matchingEventTypes:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe [EventType]
$sel:kinesisFirehoseDestination:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe KinesisFirehoseDestination
$sel:enabled:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe Bool
$sel:cloudWatchLogsDestination:EventDestinationDefinition' :: EventDestinationDefinition -> 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 Bool
enabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KinesisFirehoseDestination
kinesisFirehoseDestination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EventType]
matchingEventTypes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SnsDestination
snsDestination

instance Prelude.NFData EventDestinationDefinition where
  rnf :: EventDestinationDefinition -> ()
rnf EventDestinationDefinition' {Maybe Bool
Maybe [EventType]
Maybe CloudWatchLogsDestination
Maybe KinesisFirehoseDestination
Maybe SnsDestination
snsDestination :: Maybe SnsDestination
matchingEventTypes :: Maybe [EventType]
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
enabled :: Maybe Bool
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:snsDestination:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe SnsDestination
$sel:matchingEventTypes:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe [EventType]
$sel:kinesisFirehoseDestination:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe KinesisFirehoseDestination
$sel:enabled:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe Bool
$sel:cloudWatchLogsDestination:EventDestinationDefinition' :: EventDestinationDefinition -> 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 Bool
enabled
      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 [EventType]
matchingEventTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SnsDestination
snsDestination

instance Data.ToJSON EventDestinationDefinition where
  toJSON :: EventDestinationDefinition -> Value
toJSON EventDestinationDefinition' {Maybe Bool
Maybe [EventType]
Maybe CloudWatchLogsDestination
Maybe KinesisFirehoseDestination
Maybe SnsDestination
snsDestination :: Maybe SnsDestination
matchingEventTypes :: Maybe [EventType]
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
enabled :: Maybe Bool
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:snsDestination:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe SnsDestination
$sel:matchingEventTypes:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe [EventType]
$sel:kinesisFirehoseDestination:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe KinesisFirehoseDestination
$sel:enabled:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe Bool
$sel:cloudWatchLogsDestination:EventDestinationDefinition' :: EventDestinationDefinition -> Maybe CloudWatchLogsDestination
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CloudWatchLogsDestination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination,
            (Key
"Enabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
            (Key
"KinesisFirehoseDestination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe KinesisFirehoseDestination
kinesisFirehoseDestination,
            (Key
"MatchingEventTypes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EventType]
matchingEventTypes,
            (Key
"SnsDestination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SnsDestination
snsDestination
          ]
      )