{-# 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.PinpointEmail.Types.CloudWatchDestination where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.PinpointEmail.Types.CloudWatchDimensionConfiguration
import qualified Amazonka.Prelude as Prelude
data CloudWatchDestination = CloudWatchDestination'
{
CloudWatchDestination -> [CloudWatchDimensionConfiguration]
dimensionConfigurations :: [CloudWatchDimensionConfiguration]
}
deriving (CloudWatchDestination -> CloudWatchDestination -> Bool
(CloudWatchDestination -> CloudWatchDestination -> Bool)
-> (CloudWatchDestination -> CloudWatchDestination -> Bool)
-> Eq CloudWatchDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchDestination -> CloudWatchDestination -> Bool
$c/= :: CloudWatchDestination -> CloudWatchDestination -> Bool
== :: CloudWatchDestination -> CloudWatchDestination -> Bool
$c== :: CloudWatchDestination -> CloudWatchDestination -> Bool
Prelude.Eq, ReadPrec [CloudWatchDestination]
ReadPrec CloudWatchDestination
Int -> ReadS CloudWatchDestination
ReadS [CloudWatchDestination]
(Int -> ReadS CloudWatchDestination)
-> ReadS [CloudWatchDestination]
-> ReadPrec CloudWatchDestination
-> ReadPrec [CloudWatchDestination]
-> Read CloudWatchDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchDestination]
$creadListPrec :: ReadPrec [CloudWatchDestination]
readPrec :: ReadPrec CloudWatchDestination
$creadPrec :: ReadPrec CloudWatchDestination
readList :: ReadS [CloudWatchDestination]
$creadList :: ReadS [CloudWatchDestination]
readsPrec :: Int -> ReadS CloudWatchDestination
$creadsPrec :: Int -> ReadS CloudWatchDestination
Prelude.Read, Int -> CloudWatchDestination -> ShowS
[CloudWatchDestination] -> ShowS
CloudWatchDestination -> String
(Int -> CloudWatchDestination -> ShowS)
-> (CloudWatchDestination -> String)
-> ([CloudWatchDestination] -> ShowS)
-> Show CloudWatchDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchDestination] -> ShowS
$cshowList :: [CloudWatchDestination] -> ShowS
show :: CloudWatchDestination -> String
$cshow :: CloudWatchDestination -> String
showsPrec :: Int -> CloudWatchDestination -> ShowS
$cshowsPrec :: Int -> CloudWatchDestination -> ShowS
Prelude.Show, (forall x. CloudWatchDestination -> Rep CloudWatchDestination x)
-> (forall x. Rep CloudWatchDestination x -> CloudWatchDestination)
-> Generic CloudWatchDestination
forall x. Rep CloudWatchDestination x -> CloudWatchDestination
forall x. CloudWatchDestination -> Rep CloudWatchDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloudWatchDestination x -> CloudWatchDestination
$cfrom :: forall x. CloudWatchDestination -> Rep CloudWatchDestination x
Prelude.Generic)
newCloudWatchDestination ::
CloudWatchDestination
newCloudWatchDestination :: CloudWatchDestination
newCloudWatchDestination =
CloudWatchDestination' :: [CloudWatchDimensionConfiguration] -> CloudWatchDestination
CloudWatchDestination'
{ $sel:dimensionConfigurations:CloudWatchDestination' :: [CloudWatchDimensionConfiguration]
dimensionConfigurations =
[CloudWatchDimensionConfiguration]
forall a. Monoid a => a
Prelude.mempty
}
cloudWatchDestination_dimensionConfigurations :: Lens.Lens' CloudWatchDestination [CloudWatchDimensionConfiguration]
cloudWatchDestination_dimensionConfigurations :: ([CloudWatchDimensionConfiguration]
-> f [CloudWatchDimensionConfiguration])
-> CloudWatchDestination -> f CloudWatchDestination
cloudWatchDestination_dimensionConfigurations = (CloudWatchDestination -> [CloudWatchDimensionConfiguration])
-> (CloudWatchDestination
-> [CloudWatchDimensionConfiguration] -> CloudWatchDestination)
-> Lens
CloudWatchDestination
CloudWatchDestination
[CloudWatchDimensionConfiguration]
[CloudWatchDimensionConfiguration]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchDestination' {[CloudWatchDimensionConfiguration]
dimensionConfigurations :: [CloudWatchDimensionConfiguration]
$sel:dimensionConfigurations:CloudWatchDestination' :: CloudWatchDestination -> [CloudWatchDimensionConfiguration]
dimensionConfigurations} -> [CloudWatchDimensionConfiguration]
dimensionConfigurations) (\s :: CloudWatchDestination
s@CloudWatchDestination' {} [CloudWatchDimensionConfiguration]
a -> CloudWatchDestination
s {$sel:dimensionConfigurations:CloudWatchDestination' :: [CloudWatchDimensionConfiguration]
dimensionConfigurations = [CloudWatchDimensionConfiguration]
a} :: CloudWatchDestination) (([CloudWatchDimensionConfiguration]
-> f [CloudWatchDimensionConfiguration])
-> CloudWatchDestination -> f CloudWatchDestination)
-> (([CloudWatchDimensionConfiguration]
-> f [CloudWatchDimensionConfiguration])
-> [CloudWatchDimensionConfiguration]
-> f [CloudWatchDimensionConfiguration])
-> ([CloudWatchDimensionConfiguration]
-> f [CloudWatchDimensionConfiguration])
-> CloudWatchDestination
-> f CloudWatchDestination
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([CloudWatchDimensionConfiguration]
-> f [CloudWatchDimensionConfiguration])
-> [CloudWatchDimensionConfiguration]
-> f [CloudWatchDimensionConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON CloudWatchDestination where
parseJSON :: Value -> Parser CloudWatchDestination
parseJSON =
String
-> (Object -> Parser CloudWatchDestination)
-> Value
-> Parser CloudWatchDestination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CloudWatchDestination"
( \Object
x ->
[CloudWatchDimensionConfiguration] -> CloudWatchDestination
CloudWatchDestination'
([CloudWatchDimensionConfiguration] -> CloudWatchDestination)
-> Parser [CloudWatchDimensionConfiguration]
-> Parser CloudWatchDestination
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe [CloudWatchDimensionConfiguration])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DimensionConfigurations"
Parser (Maybe [CloudWatchDimensionConfiguration])
-> [CloudWatchDimensionConfiguration]
-> Parser [CloudWatchDimensionConfiguration]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [CloudWatchDimensionConfiguration]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable CloudWatchDestination
instance Prelude.NFData CloudWatchDestination
instance Core.ToJSON CloudWatchDestination where
toJSON :: CloudWatchDestination -> Value
toJSON CloudWatchDestination' {[CloudWatchDimensionConfiguration]
dimensionConfigurations :: [CloudWatchDimensionConfiguration]
$sel:dimensionConfigurations:CloudWatchDestination' :: CloudWatchDestination -> [CloudWatchDimensionConfiguration]
..} =
[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
"DimensionConfigurations"
Text -> [CloudWatchDimensionConfiguration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [CloudWatchDimensionConfiguration]
dimensionConfigurations
)
]
)