{-# 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.Evidently.Types.TreatmentConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data TreatmentConfig = TreatmentConfig'
{
TreatmentConfig -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
TreatmentConfig -> Text
feature :: Prelude.Text,
TreatmentConfig -> Text
name :: Prelude.Text,
TreatmentConfig -> Text
variation :: Prelude.Text
}
deriving (TreatmentConfig -> TreatmentConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TreatmentConfig -> TreatmentConfig -> Bool
$c/= :: TreatmentConfig -> TreatmentConfig -> Bool
== :: TreatmentConfig -> TreatmentConfig -> Bool
$c== :: TreatmentConfig -> TreatmentConfig -> Bool
Prelude.Eq, ReadPrec [TreatmentConfig]
ReadPrec TreatmentConfig
Int -> ReadS TreatmentConfig
ReadS [TreatmentConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TreatmentConfig]
$creadListPrec :: ReadPrec [TreatmentConfig]
readPrec :: ReadPrec TreatmentConfig
$creadPrec :: ReadPrec TreatmentConfig
readList :: ReadS [TreatmentConfig]
$creadList :: ReadS [TreatmentConfig]
readsPrec :: Int -> ReadS TreatmentConfig
$creadsPrec :: Int -> ReadS TreatmentConfig
Prelude.Read, Int -> TreatmentConfig -> ShowS
[TreatmentConfig] -> ShowS
TreatmentConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TreatmentConfig] -> ShowS
$cshowList :: [TreatmentConfig] -> ShowS
show :: TreatmentConfig -> String
$cshow :: TreatmentConfig -> String
showsPrec :: Int -> TreatmentConfig -> ShowS
$cshowsPrec :: Int -> TreatmentConfig -> ShowS
Prelude.Show, forall x. Rep TreatmentConfig x -> TreatmentConfig
forall x. TreatmentConfig -> Rep TreatmentConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TreatmentConfig x -> TreatmentConfig
$cfrom :: forall x. TreatmentConfig -> Rep TreatmentConfig x
Prelude.Generic)
newTreatmentConfig ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
TreatmentConfig
newTreatmentConfig :: Text -> Text -> Text -> TreatmentConfig
newTreatmentConfig Text
pFeature_ Text
pName_ Text
pVariation_ =
TreatmentConfig'
{ $sel:description:TreatmentConfig' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:feature:TreatmentConfig' :: Text
feature = Text
pFeature_,
$sel:name:TreatmentConfig' :: Text
name = Text
pName_,
$sel:variation:TreatmentConfig' :: Text
variation = Text
pVariation_
}
treatmentConfig_description :: Lens.Lens' TreatmentConfig (Prelude.Maybe Prelude.Text)
treatmentConfig_description :: Lens' TreatmentConfig (Maybe Text)
treatmentConfig_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentConfig' {Maybe Text
description :: Maybe Text
$sel:description:TreatmentConfig' :: TreatmentConfig -> Maybe Text
description} -> Maybe Text
description) (\s :: TreatmentConfig
s@TreatmentConfig' {} Maybe Text
a -> TreatmentConfig
s {$sel:description:TreatmentConfig' :: Maybe Text
description = Maybe Text
a} :: TreatmentConfig)
treatmentConfig_feature :: Lens.Lens' TreatmentConfig Prelude.Text
treatmentConfig_feature :: Lens' TreatmentConfig Text
treatmentConfig_feature = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentConfig' {Text
feature :: Text
$sel:feature:TreatmentConfig' :: TreatmentConfig -> Text
feature} -> Text
feature) (\s :: TreatmentConfig
s@TreatmentConfig' {} Text
a -> TreatmentConfig
s {$sel:feature:TreatmentConfig' :: Text
feature = Text
a} :: TreatmentConfig)
treatmentConfig_name :: Lens.Lens' TreatmentConfig Prelude.Text
treatmentConfig_name :: Lens' TreatmentConfig Text
treatmentConfig_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentConfig' {Text
name :: Text
$sel:name:TreatmentConfig' :: TreatmentConfig -> Text
name} -> Text
name) (\s :: TreatmentConfig
s@TreatmentConfig' {} Text
a -> TreatmentConfig
s {$sel:name:TreatmentConfig' :: Text
name = Text
a} :: TreatmentConfig)
treatmentConfig_variation :: Lens.Lens' TreatmentConfig Prelude.Text
treatmentConfig_variation :: Lens' TreatmentConfig Text
treatmentConfig_variation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TreatmentConfig' {Text
variation :: Text
$sel:variation:TreatmentConfig' :: TreatmentConfig -> Text
variation} -> Text
variation) (\s :: TreatmentConfig
s@TreatmentConfig' {} Text
a -> TreatmentConfig
s {$sel:variation:TreatmentConfig' :: Text
variation = Text
a} :: TreatmentConfig)
instance Prelude.Hashable TreatmentConfig where
hashWithSalt :: Int -> TreatmentConfig -> Int
hashWithSalt Int
_salt TreatmentConfig' {Maybe Text
Text
variation :: Text
name :: Text
feature :: Text
description :: Maybe Text
$sel:variation:TreatmentConfig' :: TreatmentConfig -> Text
$sel:name:TreatmentConfig' :: TreatmentConfig -> Text
$sel:feature:TreatmentConfig' :: TreatmentConfig -> Text
$sel:description:TreatmentConfig' :: TreatmentConfig -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
feature
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
variation
instance Prelude.NFData TreatmentConfig where
rnf :: TreatmentConfig -> ()
rnf TreatmentConfig' {Maybe Text
Text
variation :: Text
name :: Text
feature :: Text
description :: Maybe Text
$sel:variation:TreatmentConfig' :: TreatmentConfig -> Text
$sel:name:TreatmentConfig' :: TreatmentConfig -> Text
$sel:feature:TreatmentConfig' :: TreatmentConfig -> Text
$sel:description:TreatmentConfig' :: TreatmentConfig -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
feature
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
variation
instance Data.ToJSON TreatmentConfig where
toJSON :: TreatmentConfig -> Value
toJSON TreatmentConfig' {Maybe Text
Text
variation :: Text
name :: Text
feature :: Text
description :: Maybe Text
$sel:variation:TreatmentConfig' :: TreatmentConfig -> Text
$sel:name:TreatmentConfig' :: TreatmentConfig -> Text
$sel:feature:TreatmentConfig' :: TreatmentConfig -> Text
$sel:description:TreatmentConfig' :: TreatmentConfig -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"description" 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 Text
description,
forall a. a -> Maybe a
Prelude.Just (Key
"feature" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
feature),
forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"variation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
variation)
]
)