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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.PinpointSMSVoice.Types.CloudWatchLogsDestination
import Amazonka.PinpointSMSVoice.Types.EventType
import Amazonka.PinpointSMSVoice.Types.KinesisFirehoseDestination
import Amazonka.PinpointSMSVoice.Types.SnsDestination
import qualified Amazonka.Prelude as Prelude

-- | An object that defines a single event destination.
--
-- /See:/ 'newEventDestinationDefinition' smart constructor.
data EventDestinationDefinition = EventDestinationDefinition'
  { EventDestinationDefinition -> Maybe [EventType]
matchingEventTypes :: Prelude.Maybe [EventType],
    -- | 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 SnsDestination
snsDestination :: Prelude.Maybe SnsDestination,
    EventDestinationDefinition -> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination :: Prelude.Maybe CloudWatchLogsDestination
  }
  deriving (EventDestinationDefinition -> EventDestinationDefinition -> Bool
(EventDestinationDefinition -> EventDestinationDefinition -> Bool)
-> (EventDestinationDefinition
    -> EventDestinationDefinition -> Bool)
-> Eq EventDestinationDefinition
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]
(Int -> ReadS EventDestinationDefinition)
-> ReadS [EventDestinationDefinition]
-> ReadPrec EventDestinationDefinition
-> ReadPrec [EventDestinationDefinition]
-> Read 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
(Int -> EventDestinationDefinition -> ShowS)
-> (EventDestinationDefinition -> String)
-> ([EventDestinationDefinition] -> ShowS)
-> Show EventDestinationDefinition
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.
 EventDestinationDefinition -> Rep EventDestinationDefinition x)
-> (forall x.
    Rep EventDestinationDefinition x -> EventDestinationDefinition)
-> Generic EventDestinationDefinition
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:
--
-- 'matchingEventTypes', 'eventDestinationDefinition_matchingEventTypes' - 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.
--
-- 'snsDestination', 'eventDestinationDefinition_snsDestination' - Undocumented member.
--
-- 'cloudWatchLogsDestination', 'eventDestinationDefinition_cloudWatchLogsDestination' - Undocumented member.
newEventDestinationDefinition ::
  EventDestinationDefinition
newEventDestinationDefinition :: EventDestinationDefinition
newEventDestinationDefinition =
  EventDestinationDefinition' :: Maybe [EventType]
-> Maybe Bool
-> Maybe KinesisFirehoseDestination
-> Maybe SnsDestination
-> Maybe CloudWatchLogsDestination
-> EventDestinationDefinition
EventDestinationDefinition'
    { $sel:matchingEventTypes:EventDestinationDefinition' :: Maybe [EventType]
matchingEventTypes =
        Maybe [EventType]
forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:EventDestinationDefinition' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:kinesisFirehoseDestination:EventDestinationDefinition' :: Maybe KinesisFirehoseDestination
kinesisFirehoseDestination = Maybe KinesisFirehoseDestination
forall a. Maybe a
Prelude.Nothing,
      $sel:snsDestination:EventDestinationDefinition' :: Maybe SnsDestination
snsDestination = Maybe SnsDestination
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogsDestination:EventDestinationDefinition' :: Maybe CloudWatchLogsDestination
cloudWatchLogsDestination = Maybe CloudWatchLogsDestination
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
eventDestinationDefinition_matchingEventTypes :: Lens.Lens' EventDestinationDefinition (Prelude.Maybe [EventType])
eventDestinationDefinition_matchingEventTypes :: (Maybe [EventType] -> f (Maybe [EventType]))
-> EventDestinationDefinition -> f EventDestinationDefinition
eventDestinationDefinition_matchingEventTypes = (EventDestinationDefinition -> Maybe [EventType])
-> (EventDestinationDefinition
    -> Maybe [EventType] -> EventDestinationDefinition)
-> Lens
     EventDestinationDefinition
     EventDestinationDefinition
     (Maybe [EventType])
     (Maybe [EventType])
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) ((Maybe [EventType] -> f (Maybe [EventType]))
 -> EventDestinationDefinition -> f EventDestinationDefinition)
-> ((Maybe [EventType] -> f (Maybe [EventType]))
    -> Maybe [EventType] -> f (Maybe [EventType]))
-> (Maybe [EventType] -> f (Maybe [EventType]))
-> EventDestinationDefinition
-> f EventDestinationDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [EventType] [EventType] [EventType] [EventType]
-> Iso
     (Maybe [EventType])
     (Maybe [EventType])
     (Maybe [EventType])
     (Maybe [EventType])
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 AnIso [EventType] [EventType] [EventType] [EventType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> EventDestinationDefinition -> f EventDestinationDefinition
eventDestinationDefinition_enabled = (EventDestinationDefinition -> Maybe Bool)
-> (EventDestinationDefinition
    -> Maybe Bool -> EventDestinationDefinition)
-> Lens
     EventDestinationDefinition
     EventDestinationDefinition
     (Maybe Bool)
     (Maybe Bool)
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 :: (Maybe KinesisFirehoseDestination
 -> f (Maybe KinesisFirehoseDestination))
-> EventDestinationDefinition -> f EventDestinationDefinition
eventDestinationDefinition_kinesisFirehoseDestination = (EventDestinationDefinition -> Maybe KinesisFirehoseDestination)
-> (EventDestinationDefinition
    -> Maybe KinesisFirehoseDestination -> EventDestinationDefinition)
-> Lens
     EventDestinationDefinition
     EventDestinationDefinition
     (Maybe KinesisFirehoseDestination)
     (Maybe 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_snsDestination :: Lens.Lens' EventDestinationDefinition (Prelude.Maybe SnsDestination)
eventDestinationDefinition_snsDestination :: (Maybe SnsDestination -> f (Maybe SnsDestination))
-> EventDestinationDefinition -> f EventDestinationDefinition
eventDestinationDefinition_snsDestination = (EventDestinationDefinition -> Maybe SnsDestination)
-> (EventDestinationDefinition
    -> Maybe SnsDestination -> EventDestinationDefinition)
-> Lens
     EventDestinationDefinition
     EventDestinationDefinition
     (Maybe SnsDestination)
     (Maybe 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)

-- | Undocumented member.
eventDestinationDefinition_cloudWatchLogsDestination :: Lens.Lens' EventDestinationDefinition (Prelude.Maybe CloudWatchLogsDestination)
eventDestinationDefinition_cloudWatchLogsDestination :: (Maybe CloudWatchLogsDestination
 -> f (Maybe CloudWatchLogsDestination))
-> EventDestinationDefinition -> f EventDestinationDefinition
eventDestinationDefinition_cloudWatchLogsDestination = (EventDestinationDefinition -> Maybe CloudWatchLogsDestination)
-> (EventDestinationDefinition
    -> Maybe CloudWatchLogsDestination -> EventDestinationDefinition)
-> Lens
     EventDestinationDefinition
     EventDestinationDefinition
     (Maybe CloudWatchLogsDestination)
     (Maybe 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)

instance Prelude.Hashable EventDestinationDefinition

instance Prelude.NFData EventDestinationDefinition

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