{-# 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.Pinpoint.Types.CustomDeliveryConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types.EndpointTypesElement
import qualified Amazonka.Prelude as Prelude
data CustomDeliveryConfiguration = CustomDeliveryConfiguration'
{
CustomDeliveryConfiguration -> Maybe [EndpointTypesElement]
endpointTypes :: Prelude.Maybe [EndpointTypesElement],
CustomDeliveryConfiguration -> Text
deliveryUri :: Prelude.Text
}
deriving (CustomDeliveryConfiguration -> CustomDeliveryConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomDeliveryConfiguration -> CustomDeliveryConfiguration -> Bool
$c/= :: CustomDeliveryConfiguration -> CustomDeliveryConfiguration -> Bool
== :: CustomDeliveryConfiguration -> CustomDeliveryConfiguration -> Bool
$c== :: CustomDeliveryConfiguration -> CustomDeliveryConfiguration -> Bool
Prelude.Eq, ReadPrec [CustomDeliveryConfiguration]
ReadPrec CustomDeliveryConfiguration
Int -> ReadS CustomDeliveryConfiguration
ReadS [CustomDeliveryConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomDeliveryConfiguration]
$creadListPrec :: ReadPrec [CustomDeliveryConfiguration]
readPrec :: ReadPrec CustomDeliveryConfiguration
$creadPrec :: ReadPrec CustomDeliveryConfiguration
readList :: ReadS [CustomDeliveryConfiguration]
$creadList :: ReadS [CustomDeliveryConfiguration]
readsPrec :: Int -> ReadS CustomDeliveryConfiguration
$creadsPrec :: Int -> ReadS CustomDeliveryConfiguration
Prelude.Read, Int -> CustomDeliveryConfiguration -> ShowS
[CustomDeliveryConfiguration] -> ShowS
CustomDeliveryConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomDeliveryConfiguration] -> ShowS
$cshowList :: [CustomDeliveryConfiguration] -> ShowS
show :: CustomDeliveryConfiguration -> String
$cshow :: CustomDeliveryConfiguration -> String
showsPrec :: Int -> CustomDeliveryConfiguration -> ShowS
$cshowsPrec :: Int -> CustomDeliveryConfiguration -> ShowS
Prelude.Show, forall x.
Rep CustomDeliveryConfiguration x -> CustomDeliveryConfiguration
forall x.
CustomDeliveryConfiguration -> Rep CustomDeliveryConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomDeliveryConfiguration x -> CustomDeliveryConfiguration
$cfrom :: forall x.
CustomDeliveryConfiguration -> Rep CustomDeliveryConfiguration x
Prelude.Generic)
newCustomDeliveryConfiguration ::
Prelude.Text ->
CustomDeliveryConfiguration
newCustomDeliveryConfiguration :: Text -> CustomDeliveryConfiguration
newCustomDeliveryConfiguration Text
pDeliveryUri_ =
CustomDeliveryConfiguration'
{ $sel:endpointTypes:CustomDeliveryConfiguration' :: Maybe [EndpointTypesElement]
endpointTypes =
forall a. Maybe a
Prelude.Nothing,
$sel:deliveryUri:CustomDeliveryConfiguration' :: Text
deliveryUri = Text
pDeliveryUri_
}
customDeliveryConfiguration_endpointTypes :: Lens.Lens' CustomDeliveryConfiguration (Prelude.Maybe [EndpointTypesElement])
customDeliveryConfiguration_endpointTypes :: Lens' CustomDeliveryConfiguration (Maybe [EndpointTypesElement])
customDeliveryConfiguration_endpointTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDeliveryConfiguration' {Maybe [EndpointTypesElement]
endpointTypes :: Maybe [EndpointTypesElement]
$sel:endpointTypes:CustomDeliveryConfiguration' :: CustomDeliveryConfiguration -> Maybe [EndpointTypesElement]
endpointTypes} -> Maybe [EndpointTypesElement]
endpointTypes) (\s :: CustomDeliveryConfiguration
s@CustomDeliveryConfiguration' {} Maybe [EndpointTypesElement]
a -> CustomDeliveryConfiguration
s {$sel:endpointTypes:CustomDeliveryConfiguration' :: Maybe [EndpointTypesElement]
endpointTypes = Maybe [EndpointTypesElement]
a} :: CustomDeliveryConfiguration) 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
customDeliveryConfiguration_deliveryUri :: Lens.Lens' CustomDeliveryConfiguration Prelude.Text
customDeliveryConfiguration_deliveryUri :: Lens' CustomDeliveryConfiguration Text
customDeliveryConfiguration_deliveryUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomDeliveryConfiguration' {Text
deliveryUri :: Text
$sel:deliveryUri:CustomDeliveryConfiguration' :: CustomDeliveryConfiguration -> Text
deliveryUri} -> Text
deliveryUri) (\s :: CustomDeliveryConfiguration
s@CustomDeliveryConfiguration' {} Text
a -> CustomDeliveryConfiguration
s {$sel:deliveryUri:CustomDeliveryConfiguration' :: Text
deliveryUri = Text
a} :: CustomDeliveryConfiguration)
instance Data.FromJSON CustomDeliveryConfiguration where
parseJSON :: Value -> Parser CustomDeliveryConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CustomDeliveryConfiguration"
( \Object
x ->
Maybe [EndpointTypesElement] -> Text -> CustomDeliveryConfiguration
CustomDeliveryConfiguration'
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
"EndpointTypes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"DeliveryUri")
)
instance Prelude.Hashable CustomDeliveryConfiguration where
hashWithSalt :: Int -> CustomDeliveryConfiguration -> Int
hashWithSalt Int
_salt CustomDeliveryConfiguration' {Maybe [EndpointTypesElement]
Text
deliveryUri :: Text
endpointTypes :: Maybe [EndpointTypesElement]
$sel:deliveryUri:CustomDeliveryConfiguration' :: CustomDeliveryConfiguration -> Text
$sel:endpointTypes:CustomDeliveryConfiguration' :: CustomDeliveryConfiguration -> Maybe [EndpointTypesElement]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EndpointTypesElement]
endpointTypes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deliveryUri
instance Prelude.NFData CustomDeliveryConfiguration where
rnf :: CustomDeliveryConfiguration -> ()
rnf CustomDeliveryConfiguration' {Maybe [EndpointTypesElement]
Text
deliveryUri :: Text
endpointTypes :: Maybe [EndpointTypesElement]
$sel:deliveryUri:CustomDeliveryConfiguration' :: CustomDeliveryConfiguration -> Text
$sel:endpointTypes:CustomDeliveryConfiguration' :: CustomDeliveryConfiguration -> Maybe [EndpointTypesElement]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [EndpointTypesElement]
endpointTypes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
deliveryUri
instance Data.ToJSON CustomDeliveryConfiguration where
toJSON :: CustomDeliveryConfiguration -> Value
toJSON CustomDeliveryConfiguration' {Maybe [EndpointTypesElement]
Text
deliveryUri :: Text
endpointTypes :: Maybe [EndpointTypesElement]
$sel:deliveryUri:CustomDeliveryConfiguration' :: CustomDeliveryConfiguration -> Text
$sel:endpointTypes:CustomDeliveryConfiguration' :: CustomDeliveryConfiguration -> Maybe [EndpointTypesElement]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"EndpointTypes" 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 [EndpointTypesElement]
endpointTypes,
forall a. a -> Maybe a
Prelude.Just (Key
"DeliveryUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
deliveryUri)
]
)