{-# 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.XRay.Types.SamplingStrategy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.XRay.Types.SamplingStrategyName
data SamplingStrategy = SamplingStrategy'
{
SamplingStrategy -> Maybe Double
value :: Prelude.Maybe Prelude.Double,
SamplingStrategy -> Maybe SamplingStrategyName
name :: Prelude.Maybe SamplingStrategyName
}
deriving (SamplingStrategy -> SamplingStrategy -> Bool
(SamplingStrategy -> SamplingStrategy -> Bool)
-> (SamplingStrategy -> SamplingStrategy -> Bool)
-> Eq SamplingStrategy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SamplingStrategy -> SamplingStrategy -> Bool
$c/= :: SamplingStrategy -> SamplingStrategy -> Bool
== :: SamplingStrategy -> SamplingStrategy -> Bool
$c== :: SamplingStrategy -> SamplingStrategy -> Bool
Prelude.Eq, ReadPrec [SamplingStrategy]
ReadPrec SamplingStrategy
Int -> ReadS SamplingStrategy
ReadS [SamplingStrategy]
(Int -> ReadS SamplingStrategy)
-> ReadS [SamplingStrategy]
-> ReadPrec SamplingStrategy
-> ReadPrec [SamplingStrategy]
-> Read SamplingStrategy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SamplingStrategy]
$creadListPrec :: ReadPrec [SamplingStrategy]
readPrec :: ReadPrec SamplingStrategy
$creadPrec :: ReadPrec SamplingStrategy
readList :: ReadS [SamplingStrategy]
$creadList :: ReadS [SamplingStrategy]
readsPrec :: Int -> ReadS SamplingStrategy
$creadsPrec :: Int -> ReadS SamplingStrategy
Prelude.Read, Int -> SamplingStrategy -> ShowS
[SamplingStrategy] -> ShowS
SamplingStrategy -> String
(Int -> SamplingStrategy -> ShowS)
-> (SamplingStrategy -> String)
-> ([SamplingStrategy] -> ShowS)
-> Show SamplingStrategy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SamplingStrategy] -> ShowS
$cshowList :: [SamplingStrategy] -> ShowS
show :: SamplingStrategy -> String
$cshow :: SamplingStrategy -> String
showsPrec :: Int -> SamplingStrategy -> ShowS
$cshowsPrec :: Int -> SamplingStrategy -> ShowS
Prelude.Show, (forall x. SamplingStrategy -> Rep SamplingStrategy x)
-> (forall x. Rep SamplingStrategy x -> SamplingStrategy)
-> Generic SamplingStrategy
forall x. Rep SamplingStrategy x -> SamplingStrategy
forall x. SamplingStrategy -> Rep SamplingStrategy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SamplingStrategy x -> SamplingStrategy
$cfrom :: forall x. SamplingStrategy -> Rep SamplingStrategy x
Prelude.Generic)
newSamplingStrategy ::
SamplingStrategy
newSamplingStrategy :: SamplingStrategy
newSamplingStrategy =
SamplingStrategy' :: Maybe Double -> Maybe SamplingStrategyName -> SamplingStrategy
SamplingStrategy'
{ $sel:value:SamplingStrategy' :: Maybe Double
value = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:name:SamplingStrategy' :: Maybe SamplingStrategyName
name = Maybe SamplingStrategyName
forall a. Maybe a
Prelude.Nothing
}
samplingStrategy_value :: Lens.Lens' SamplingStrategy (Prelude.Maybe Prelude.Double)
samplingStrategy_value :: (Maybe Double -> f (Maybe Double))
-> SamplingStrategy -> f SamplingStrategy
samplingStrategy_value = (SamplingStrategy -> Maybe Double)
-> (SamplingStrategy -> Maybe Double -> SamplingStrategy)
-> Lens
SamplingStrategy SamplingStrategy (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingStrategy' {Maybe Double
value :: Maybe Double
$sel:value:SamplingStrategy' :: SamplingStrategy -> Maybe Double
value} -> Maybe Double
value) (\s :: SamplingStrategy
s@SamplingStrategy' {} Maybe Double
a -> SamplingStrategy
s {$sel:value:SamplingStrategy' :: Maybe Double
value = Maybe Double
a} :: SamplingStrategy)
samplingStrategy_name :: Lens.Lens' SamplingStrategy (Prelude.Maybe SamplingStrategyName)
samplingStrategy_name :: (Maybe SamplingStrategyName -> f (Maybe SamplingStrategyName))
-> SamplingStrategy -> f SamplingStrategy
samplingStrategy_name = (SamplingStrategy -> Maybe SamplingStrategyName)
-> (SamplingStrategy
-> Maybe SamplingStrategyName -> SamplingStrategy)
-> Lens
SamplingStrategy
SamplingStrategy
(Maybe SamplingStrategyName)
(Maybe SamplingStrategyName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingStrategy' {Maybe SamplingStrategyName
name :: Maybe SamplingStrategyName
$sel:name:SamplingStrategy' :: SamplingStrategy -> Maybe SamplingStrategyName
name} -> Maybe SamplingStrategyName
name) (\s :: SamplingStrategy
s@SamplingStrategy' {} Maybe SamplingStrategyName
a -> SamplingStrategy
s {$sel:name:SamplingStrategy' :: Maybe SamplingStrategyName
name = Maybe SamplingStrategyName
a} :: SamplingStrategy)
instance Prelude.Hashable SamplingStrategy
instance Prelude.NFData SamplingStrategy
instance Core.ToJSON SamplingStrategy where
toJSON :: SamplingStrategy -> Value
toJSON SamplingStrategy' {Maybe Double
Maybe SamplingStrategyName
name :: Maybe SamplingStrategyName
value :: Maybe Double
$sel:name:SamplingStrategy' :: SamplingStrategy -> Maybe SamplingStrategyName
$sel:value:SamplingStrategy' :: SamplingStrategy -> Maybe Double
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Value" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
value,
(Text
"Name" Text -> SamplingStrategyName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SamplingStrategyName -> Pair)
-> Maybe SamplingStrategyName -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SamplingStrategyName
name
]
)