{-# 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.TreatmentResource where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.CampaignState
import Amazonka.Pinpoint.Types.CustomDeliveryConfiguration
import Amazonka.Pinpoint.Types.MessageConfiguration
import Amazonka.Pinpoint.Types.Schedule
import Amazonka.Pinpoint.Types.TemplateConfiguration
import qualified Amazonka.Prelude as Prelude
data TreatmentResource = TreatmentResource'
{
TreatmentResource -> Maybe CustomDeliveryConfiguration
customDeliveryConfiguration :: Prelude.Maybe CustomDeliveryConfiguration,
TreatmentResource -> Maybe CampaignState
state :: Prelude.Maybe CampaignState,
TreatmentResource -> Maybe Schedule
schedule :: Prelude.Maybe Schedule,
TreatmentResource -> Maybe TemplateConfiguration
templateConfiguration :: Prelude.Maybe TemplateConfiguration,
TreatmentResource -> Maybe Text
treatmentName :: Prelude.Maybe Prelude.Text,
TreatmentResource -> Maybe Text
treatmentDescription :: Prelude.Maybe Prelude.Text,
TreatmentResource -> Maybe MessageConfiguration
messageConfiguration :: Prelude.Maybe MessageConfiguration,
TreatmentResource -> Text
id :: Prelude.Text,
TreatmentResource -> Int
sizePercent :: Prelude.Int
}
deriving (TreatmentResource -> TreatmentResource -> Bool
(TreatmentResource -> TreatmentResource -> Bool)
-> (TreatmentResource -> TreatmentResource -> Bool)
-> Eq TreatmentResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TreatmentResource -> TreatmentResource -> Bool
$c/= :: TreatmentResource -> TreatmentResource -> Bool
== :: TreatmentResource -> TreatmentResource -> Bool
$c== :: TreatmentResource -> TreatmentResource -> Bool
Prelude.Eq, ReadPrec [TreatmentResource]
ReadPrec TreatmentResource
Int -> ReadS TreatmentResource
ReadS [TreatmentResource]
(Int -> ReadS TreatmentResource)
-> ReadS [TreatmentResource]
-> ReadPrec TreatmentResource
-> ReadPrec [TreatmentResource]
-> Read TreatmentResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TreatmentResource]
$creadListPrec :: ReadPrec [TreatmentResource]
readPrec :: ReadPrec TreatmentResource
$creadPrec :: ReadPrec TreatmentResource
readList :: ReadS [TreatmentResource]
$creadList :: ReadS [TreatmentResource]
readsPrec :: Int -> ReadS TreatmentResource
$creadsPrec :: Int -> ReadS TreatmentResource
Prelude.Read, Int -> TreatmentResource -> ShowS
[TreatmentResource] -> ShowS
TreatmentResource -> String
(Int -> TreatmentResource -> ShowS)
-> (TreatmentResource -> String)
-> ([TreatmentResource] -> ShowS)
-> Show TreatmentResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TreatmentResource] -> ShowS
$cshowList :: [TreatmentResource] -> ShowS
show :: TreatmentResource -> String
$cshow :: TreatmentResource -> String
showsPrec :: Int -> TreatmentResource -> ShowS
$cshowsPrec :: Int -> TreatmentResource -> ShowS
Prelude.Show, (forall x. TreatmentResource -> Rep TreatmentResource x)
-> (forall x. Rep TreatmentResource x -> TreatmentResource)
-> Generic TreatmentResource
forall x. Rep TreatmentResource x -> TreatmentResource
forall x. TreatmentResource -> Rep TreatmentResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TreatmentResource x -> TreatmentResource
$cfrom :: forall x. TreatmentResource -> Rep TreatmentResource x
Prelude.Generic)
newTreatmentResource ::
Prelude.Text ->
Prelude.Int ->
TreatmentResource
newTreatmentResource :: Text -> Int -> TreatmentResource
newTreatmentResource Text
pId_ Int
pSizePercent_ =
TreatmentResource' :: Maybe CustomDeliveryConfiguration
-> Maybe CampaignState
-> Maybe Schedule
-> Maybe TemplateConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource
TreatmentResource'
{ $sel:customDeliveryConfiguration:TreatmentResource' :: Maybe CustomDeliveryConfiguration
customDeliveryConfiguration =
Maybe CustomDeliveryConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:state:TreatmentResource' :: Maybe CampaignState
state = Maybe CampaignState
forall a. Maybe a
Prelude.Nothing,
$sel:schedule:TreatmentResource' :: Maybe Schedule
schedule = Maybe Schedule
forall a. Maybe a
Prelude.Nothing,
$sel:templateConfiguration:TreatmentResource' :: Maybe TemplateConfiguration
templateConfiguration = Maybe TemplateConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:treatmentName:TreatmentResource' :: Maybe Text
treatmentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:treatmentDescription:TreatmentResource' :: Maybe Text
treatmentDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:messageConfiguration:TreatmentResource' :: Maybe MessageConfiguration
messageConfiguration = Maybe MessageConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:id:TreatmentResource' :: Text
id = Text
pId_,
$sel:sizePercent:TreatmentResource' :: Int
sizePercent = Int
pSizePercent_
}
treatmentResource_customDeliveryConfiguration :: Lens.Lens' TreatmentResource (Prelude.Maybe CustomDeliveryConfiguration)
treatmentResource_customDeliveryConfiguration :: (Maybe CustomDeliveryConfiguration
-> f (Maybe CustomDeliveryConfiguration))
-> TreatmentResource -> f TreatmentResource
treatmentResource_customDeliveryConfiguration = (TreatmentResource -> Maybe CustomDeliveryConfiguration)
-> (TreatmentResource
-> Maybe CustomDeliveryConfiguration -> TreatmentResource)
-> Lens
TreatmentResource
TreatmentResource
(Maybe CustomDeliveryConfiguration)
(Maybe CustomDeliveryConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentResource' {Maybe CustomDeliveryConfiguration
customDeliveryConfiguration :: Maybe CustomDeliveryConfiguration
$sel:customDeliveryConfiguration:TreatmentResource' :: TreatmentResource -> Maybe CustomDeliveryConfiguration
customDeliveryConfiguration} -> Maybe CustomDeliveryConfiguration
customDeliveryConfiguration) (\s :: TreatmentResource
s@TreatmentResource' {} Maybe CustomDeliveryConfiguration
a -> TreatmentResource
s {$sel:customDeliveryConfiguration:TreatmentResource' :: Maybe CustomDeliveryConfiguration
customDeliveryConfiguration = Maybe CustomDeliveryConfiguration
a} :: TreatmentResource)
treatmentResource_state :: Lens.Lens' TreatmentResource (Prelude.Maybe CampaignState)
treatmentResource_state :: (Maybe CampaignState -> f (Maybe CampaignState))
-> TreatmentResource -> f TreatmentResource
treatmentResource_state = (TreatmentResource -> Maybe CampaignState)
-> (TreatmentResource -> Maybe CampaignState -> TreatmentResource)
-> Lens
TreatmentResource
TreatmentResource
(Maybe CampaignState)
(Maybe CampaignState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentResource' {Maybe CampaignState
state :: Maybe CampaignState
$sel:state:TreatmentResource' :: TreatmentResource -> Maybe CampaignState
state} -> Maybe CampaignState
state) (\s :: TreatmentResource
s@TreatmentResource' {} Maybe CampaignState
a -> TreatmentResource
s {$sel:state:TreatmentResource' :: Maybe CampaignState
state = Maybe CampaignState
a} :: TreatmentResource)
treatmentResource_schedule :: Lens.Lens' TreatmentResource (Prelude.Maybe Schedule)
treatmentResource_schedule :: (Maybe Schedule -> f (Maybe Schedule))
-> TreatmentResource -> f TreatmentResource
treatmentResource_schedule = (TreatmentResource -> Maybe Schedule)
-> (TreatmentResource -> Maybe Schedule -> TreatmentResource)
-> Lens
TreatmentResource
TreatmentResource
(Maybe Schedule)
(Maybe Schedule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentResource' {Maybe Schedule
schedule :: Maybe Schedule
$sel:schedule:TreatmentResource' :: TreatmentResource -> Maybe Schedule
schedule} -> Maybe Schedule
schedule) (\s :: TreatmentResource
s@TreatmentResource' {} Maybe Schedule
a -> TreatmentResource
s {$sel:schedule:TreatmentResource' :: Maybe Schedule
schedule = Maybe Schedule
a} :: TreatmentResource)
treatmentResource_templateConfiguration :: Lens.Lens' TreatmentResource (Prelude.Maybe TemplateConfiguration)
treatmentResource_templateConfiguration :: (Maybe TemplateConfiguration -> f (Maybe TemplateConfiguration))
-> TreatmentResource -> f TreatmentResource
treatmentResource_templateConfiguration = (TreatmentResource -> Maybe TemplateConfiguration)
-> (TreatmentResource
-> Maybe TemplateConfiguration -> TreatmentResource)
-> Lens
TreatmentResource
TreatmentResource
(Maybe TemplateConfiguration)
(Maybe TemplateConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentResource' {Maybe TemplateConfiguration
templateConfiguration :: Maybe TemplateConfiguration
$sel:templateConfiguration:TreatmentResource' :: TreatmentResource -> Maybe TemplateConfiguration
templateConfiguration} -> Maybe TemplateConfiguration
templateConfiguration) (\s :: TreatmentResource
s@TreatmentResource' {} Maybe TemplateConfiguration
a -> TreatmentResource
s {$sel:templateConfiguration:TreatmentResource' :: Maybe TemplateConfiguration
templateConfiguration = Maybe TemplateConfiguration
a} :: TreatmentResource)
treatmentResource_treatmentName :: Lens.Lens' TreatmentResource (Prelude.Maybe Prelude.Text)
treatmentResource_treatmentName :: (Maybe Text -> f (Maybe Text))
-> TreatmentResource -> f TreatmentResource
treatmentResource_treatmentName = (TreatmentResource -> Maybe Text)
-> (TreatmentResource -> Maybe Text -> TreatmentResource)
-> Lens
TreatmentResource TreatmentResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentResource' {Maybe Text
treatmentName :: Maybe Text
$sel:treatmentName:TreatmentResource' :: TreatmentResource -> Maybe Text
treatmentName} -> Maybe Text
treatmentName) (\s :: TreatmentResource
s@TreatmentResource' {} Maybe Text
a -> TreatmentResource
s {$sel:treatmentName:TreatmentResource' :: Maybe Text
treatmentName = Maybe Text
a} :: TreatmentResource)
treatmentResource_treatmentDescription :: Lens.Lens' TreatmentResource (Prelude.Maybe Prelude.Text)
treatmentResource_treatmentDescription :: (Maybe Text -> f (Maybe Text))
-> TreatmentResource -> f TreatmentResource
treatmentResource_treatmentDescription = (TreatmentResource -> Maybe Text)
-> (TreatmentResource -> Maybe Text -> TreatmentResource)
-> Lens
TreatmentResource TreatmentResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentResource' {Maybe Text
treatmentDescription :: Maybe Text
$sel:treatmentDescription:TreatmentResource' :: TreatmentResource -> Maybe Text
treatmentDescription} -> Maybe Text
treatmentDescription) (\s :: TreatmentResource
s@TreatmentResource' {} Maybe Text
a -> TreatmentResource
s {$sel:treatmentDescription:TreatmentResource' :: Maybe Text
treatmentDescription = Maybe Text
a} :: TreatmentResource)
treatmentResource_messageConfiguration :: Lens.Lens' TreatmentResource (Prelude.Maybe MessageConfiguration)
treatmentResource_messageConfiguration :: (Maybe MessageConfiguration -> f (Maybe MessageConfiguration))
-> TreatmentResource -> f TreatmentResource
treatmentResource_messageConfiguration = (TreatmentResource -> Maybe MessageConfiguration)
-> (TreatmentResource
-> Maybe MessageConfiguration -> TreatmentResource)
-> Lens
TreatmentResource
TreatmentResource
(Maybe MessageConfiguration)
(Maybe MessageConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentResource' {Maybe MessageConfiguration
messageConfiguration :: Maybe MessageConfiguration
$sel:messageConfiguration:TreatmentResource' :: TreatmentResource -> Maybe MessageConfiguration
messageConfiguration} -> Maybe MessageConfiguration
messageConfiguration) (\s :: TreatmentResource
s@TreatmentResource' {} Maybe MessageConfiguration
a -> TreatmentResource
s {$sel:messageConfiguration:TreatmentResource' :: Maybe MessageConfiguration
messageConfiguration = Maybe MessageConfiguration
a} :: TreatmentResource)
treatmentResource_id :: Lens.Lens' TreatmentResource Prelude.Text
treatmentResource_id :: (Text -> f Text) -> TreatmentResource -> f TreatmentResource
treatmentResource_id = (TreatmentResource -> Text)
-> (TreatmentResource -> Text -> TreatmentResource)
-> Lens TreatmentResource TreatmentResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentResource' {Text
id :: Text
$sel:id:TreatmentResource' :: TreatmentResource -> Text
id} -> Text
id) (\s :: TreatmentResource
s@TreatmentResource' {} Text
a -> TreatmentResource
s {$sel:id:TreatmentResource' :: Text
id = Text
a} :: TreatmentResource)
treatmentResource_sizePercent :: Lens.Lens' TreatmentResource Prelude.Int
treatmentResource_sizePercent :: (Int -> f Int) -> TreatmentResource -> f TreatmentResource
treatmentResource_sizePercent = (TreatmentResource -> Int)
-> (TreatmentResource -> Int -> TreatmentResource)
-> Lens TreatmentResource TreatmentResource Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentResource' {Int
sizePercent :: Int
$sel:sizePercent:TreatmentResource' :: TreatmentResource -> Int
sizePercent} -> Int
sizePercent) (\s :: TreatmentResource
s@TreatmentResource' {} Int
a -> TreatmentResource
s {$sel:sizePercent:TreatmentResource' :: Int
sizePercent = Int
a} :: TreatmentResource)
instance Core.FromJSON TreatmentResource where
parseJSON :: Value -> Parser TreatmentResource
parseJSON =
String
-> (Object -> Parser TreatmentResource)
-> Value
-> Parser TreatmentResource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"TreatmentResource"
( \Object
x ->
Maybe CustomDeliveryConfiguration
-> Maybe CampaignState
-> Maybe Schedule
-> Maybe TemplateConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource
TreatmentResource'
(Maybe CustomDeliveryConfiguration
-> Maybe CampaignState
-> Maybe Schedule
-> Maybe TemplateConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource)
-> Parser (Maybe CustomDeliveryConfiguration)
-> Parser
(Maybe CampaignState
-> Maybe Schedule
-> Maybe TemplateConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CustomDeliveryConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CustomDeliveryConfiguration")
Parser
(Maybe CampaignState
-> Maybe Schedule
-> Maybe TemplateConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource)
-> Parser (Maybe CampaignState)
-> Parser
(Maybe Schedule
-> Maybe TemplateConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CampaignState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
Parser
(Maybe Schedule
-> Maybe TemplateConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource)
-> Parser (Maybe Schedule)
-> Parser
(Maybe TemplateConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Schedule)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Schedule")
Parser
(Maybe TemplateConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource)
-> Parser (Maybe TemplateConfiguration)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TemplateConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TemplateConfiguration")
Parser
(Maybe Text
-> Maybe Text
-> Maybe MessageConfiguration
-> Text
-> Int
-> TreatmentResource)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe MessageConfiguration -> Text -> Int -> TreatmentResource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TreatmentName")
Parser
(Maybe Text
-> Maybe MessageConfiguration -> Text -> Int -> TreatmentResource)
-> Parser (Maybe Text)
-> Parser
(Maybe MessageConfiguration -> Text -> Int -> TreatmentResource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TreatmentDescription")
Parser
(Maybe MessageConfiguration -> Text -> Int -> TreatmentResource)
-> Parser (Maybe MessageConfiguration)
-> Parser (Text -> Int -> TreatmentResource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MessageConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MessageConfiguration")
Parser (Text -> Int -> TreatmentResource)
-> Parser Text -> Parser (Int -> TreatmentResource)
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
"Id")
Parser (Int -> TreatmentResource)
-> Parser Int -> Parser TreatmentResource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SizePercent")
)
instance Prelude.Hashable TreatmentResource
instance Prelude.NFData TreatmentResource