{-# 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.Lens as Lens
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
(CustomDeliveryConfiguration
-> CustomDeliveryConfiguration -> Bool)
-> (CustomDeliveryConfiguration
-> CustomDeliveryConfiguration -> Bool)
-> Eq CustomDeliveryConfiguration
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]
(Int -> ReadS CustomDeliveryConfiguration)
-> ReadS [CustomDeliveryConfiguration]
-> ReadPrec CustomDeliveryConfiguration
-> ReadPrec [CustomDeliveryConfiguration]
-> Read 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
(Int -> CustomDeliveryConfiguration -> ShowS)
-> (CustomDeliveryConfiguration -> String)
-> ([CustomDeliveryConfiguration] -> ShowS)
-> Show CustomDeliveryConfiguration
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.
CustomDeliveryConfiguration -> Rep CustomDeliveryConfiguration x)
-> (forall x.
Rep CustomDeliveryConfiguration x -> CustomDeliveryConfiguration)
-> Generic CustomDeliveryConfiguration
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' :: Maybe [EndpointTypesElement] -> Text -> CustomDeliveryConfiguration
CustomDeliveryConfiguration'
{ $sel:endpointTypes:CustomDeliveryConfiguration' :: Maybe [EndpointTypesElement]
endpointTypes =
Maybe [EndpointTypesElement]
forall a. Maybe a
Prelude.Nothing,
$sel:deliveryUri:CustomDeliveryConfiguration' :: Text
deliveryUri = Text
pDeliveryUri_
}
customDeliveryConfiguration_endpointTypes :: Lens.Lens' CustomDeliveryConfiguration (Prelude.Maybe [EndpointTypesElement])
customDeliveryConfiguration_endpointTypes :: (Maybe [EndpointTypesElement] -> f (Maybe [EndpointTypesElement]))
-> CustomDeliveryConfiguration -> f CustomDeliveryConfiguration
customDeliveryConfiguration_endpointTypes = (CustomDeliveryConfiguration -> Maybe [EndpointTypesElement])
-> (CustomDeliveryConfiguration
-> Maybe [EndpointTypesElement] -> CustomDeliveryConfiguration)
-> Lens
CustomDeliveryConfiguration
CustomDeliveryConfiguration
(Maybe [EndpointTypesElement])
(Maybe [EndpointTypesElement])
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) ((Maybe [EndpointTypesElement] -> f (Maybe [EndpointTypesElement]))
-> CustomDeliveryConfiguration -> f CustomDeliveryConfiguration)
-> ((Maybe [EndpointTypesElement]
-> f (Maybe [EndpointTypesElement]))
-> Maybe [EndpointTypesElement]
-> f (Maybe [EndpointTypesElement]))
-> (Maybe [EndpointTypesElement]
-> f (Maybe [EndpointTypesElement]))
-> CustomDeliveryConfiguration
-> f CustomDeliveryConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[EndpointTypesElement]
[EndpointTypesElement]
[EndpointTypesElement]
[EndpointTypesElement]
-> Iso
(Maybe [EndpointTypesElement])
(Maybe [EndpointTypesElement])
(Maybe [EndpointTypesElement])
(Maybe [EndpointTypesElement])
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
[EndpointTypesElement]
[EndpointTypesElement]
[EndpointTypesElement]
[EndpointTypesElement]
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 :: (Text -> f Text)
-> CustomDeliveryConfiguration -> f CustomDeliveryConfiguration
customDeliveryConfiguration_deliveryUri = (CustomDeliveryConfiguration -> Text)
-> (CustomDeliveryConfiguration
-> Text -> CustomDeliveryConfiguration)
-> Lens
CustomDeliveryConfiguration CustomDeliveryConfiguration Text Text
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 Core.FromJSON CustomDeliveryConfiguration where
parseJSON :: Value -> Parser CustomDeliveryConfiguration
parseJSON =
String
-> (Object -> Parser CustomDeliveryConfiguration)
-> Value
-> Parser CustomDeliveryConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CustomDeliveryConfiguration"
( \Object
x ->
Maybe [EndpointTypesElement] -> Text -> CustomDeliveryConfiguration
CustomDeliveryConfiguration'
(Maybe [EndpointTypesElement]
-> Text -> CustomDeliveryConfiguration)
-> Parser (Maybe [EndpointTypesElement])
-> Parser (Text -> CustomDeliveryConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [EndpointTypesElement]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndpointTypes" Parser (Maybe (Maybe [EndpointTypesElement]))
-> Maybe [EndpointTypesElement]
-> Parser (Maybe [EndpointTypesElement])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [EndpointTypesElement]
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> CustomDeliveryConfiguration)
-> Parser Text -> Parser CustomDeliveryConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DeliveryUri")
)
instance Prelude.Hashable CustomDeliveryConfiguration
instance Prelude.NFData CustomDeliveryConfiguration
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EndpointTypes" Text -> [EndpointTypesElement] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([EndpointTypesElement] -> Pair)
-> Maybe [EndpointTypesElement] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EndpointTypesElement]
endpointTypes,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DeliveryUri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deliveryUri)
]
)