{-# 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.SamplingRule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SamplingRule = SamplingRule'
{
SamplingRule -> Maybe Text
ruleName :: Prelude.Maybe Prelude.Text,
SamplingRule -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
SamplingRule -> Maybe Text
ruleARN :: Prelude.Maybe Prelude.Text,
SamplingRule -> Text
resourceARN :: Prelude.Text,
SamplingRule -> Natural
priority :: Prelude.Natural,
SamplingRule -> Double
fixedRate :: Prelude.Double,
SamplingRule -> Natural
reservoirSize :: Prelude.Natural,
SamplingRule -> Text
serviceName :: Prelude.Text,
SamplingRule -> Text
serviceType :: Prelude.Text,
SamplingRule -> Text
host :: Prelude.Text,
SamplingRule -> Text
hTTPMethod :: Prelude.Text,
SamplingRule -> Text
uRLPath :: Prelude.Text,
SamplingRule -> Natural
version :: Prelude.Natural
}
deriving (SamplingRule -> SamplingRule -> Bool
(SamplingRule -> SamplingRule -> Bool)
-> (SamplingRule -> SamplingRule -> Bool) -> Eq SamplingRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SamplingRule -> SamplingRule -> Bool
$c/= :: SamplingRule -> SamplingRule -> Bool
== :: SamplingRule -> SamplingRule -> Bool
$c== :: SamplingRule -> SamplingRule -> Bool
Prelude.Eq, ReadPrec [SamplingRule]
ReadPrec SamplingRule
Int -> ReadS SamplingRule
ReadS [SamplingRule]
(Int -> ReadS SamplingRule)
-> ReadS [SamplingRule]
-> ReadPrec SamplingRule
-> ReadPrec [SamplingRule]
-> Read SamplingRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SamplingRule]
$creadListPrec :: ReadPrec [SamplingRule]
readPrec :: ReadPrec SamplingRule
$creadPrec :: ReadPrec SamplingRule
readList :: ReadS [SamplingRule]
$creadList :: ReadS [SamplingRule]
readsPrec :: Int -> ReadS SamplingRule
$creadsPrec :: Int -> ReadS SamplingRule
Prelude.Read, Int -> SamplingRule -> ShowS
[SamplingRule] -> ShowS
SamplingRule -> String
(Int -> SamplingRule -> ShowS)
-> (SamplingRule -> String)
-> ([SamplingRule] -> ShowS)
-> Show SamplingRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SamplingRule] -> ShowS
$cshowList :: [SamplingRule] -> ShowS
show :: SamplingRule -> String
$cshow :: SamplingRule -> String
showsPrec :: Int -> SamplingRule -> ShowS
$cshowsPrec :: Int -> SamplingRule -> ShowS
Prelude.Show, (forall x. SamplingRule -> Rep SamplingRule x)
-> (forall x. Rep SamplingRule x -> SamplingRule)
-> Generic SamplingRule
forall x. Rep SamplingRule x -> SamplingRule
forall x. SamplingRule -> Rep SamplingRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SamplingRule x -> SamplingRule
$cfrom :: forall x. SamplingRule -> Rep SamplingRule x
Prelude.Generic)
newSamplingRule ::
Prelude.Text ->
Prelude.Natural ->
Prelude.Double ->
Prelude.Natural ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Natural ->
SamplingRule
newSamplingRule :: Text
-> Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule
newSamplingRule
Text
pResourceARN_
Natural
pPriority_
Double
pFixedRate_
Natural
pReservoirSize_
Text
pServiceName_
Text
pServiceType_
Text
pHost_
Text
pHTTPMethod_
Text
pURLPath_
Natural
pVersion_ =
SamplingRule' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Text
-> Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule
SamplingRule'
{ $sel:ruleName:SamplingRule' :: Maybe Text
ruleName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:attributes:SamplingRule' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:ruleARN:SamplingRule' :: Maybe Text
ruleARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceARN:SamplingRule' :: Text
resourceARN = Text
pResourceARN_,
$sel:priority:SamplingRule' :: Natural
priority = Natural
pPriority_,
$sel:fixedRate:SamplingRule' :: Double
fixedRate = Double
pFixedRate_,
$sel:reservoirSize:SamplingRule' :: Natural
reservoirSize = Natural
pReservoirSize_,
$sel:serviceName:SamplingRule' :: Text
serviceName = Text
pServiceName_,
$sel:serviceType:SamplingRule' :: Text
serviceType = Text
pServiceType_,
$sel:host:SamplingRule' :: Text
host = Text
pHost_,
$sel:hTTPMethod:SamplingRule' :: Text
hTTPMethod = Text
pHTTPMethod_,
$sel:uRLPath:SamplingRule' :: Text
uRLPath = Text
pURLPath_,
$sel:version:SamplingRule' :: Natural
version = Natural
pVersion_
}
samplingRule_ruleName :: Lens.Lens' SamplingRule (Prelude.Maybe Prelude.Text)
samplingRule_ruleName :: (Maybe Text -> f (Maybe Text)) -> SamplingRule -> f SamplingRule
samplingRule_ruleName = (SamplingRule -> Maybe Text)
-> (SamplingRule -> Maybe Text -> SamplingRule)
-> Lens SamplingRule SamplingRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Maybe Text
ruleName :: Maybe Text
$sel:ruleName:SamplingRule' :: SamplingRule -> Maybe Text
ruleName} -> Maybe Text
ruleName) (\s :: SamplingRule
s@SamplingRule' {} Maybe Text
a -> SamplingRule
s {$sel:ruleName:SamplingRule' :: Maybe Text
ruleName = Maybe Text
a} :: SamplingRule)
samplingRule_attributes :: Lens.Lens' SamplingRule (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
samplingRule_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> SamplingRule -> f SamplingRule
samplingRule_attributes = (SamplingRule -> Maybe (HashMap Text Text))
-> (SamplingRule -> Maybe (HashMap Text Text) -> SamplingRule)
-> Lens
SamplingRule
SamplingRule
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:SamplingRule' :: SamplingRule -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: SamplingRule
s@SamplingRule' {} Maybe (HashMap Text Text)
a -> SamplingRule
s {$sel:attributes:SamplingRule' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: SamplingRule) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> SamplingRule -> f SamplingRule)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> SamplingRule
-> f SamplingRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
samplingRule_ruleARN :: Lens.Lens' SamplingRule (Prelude.Maybe Prelude.Text)
samplingRule_ruleARN :: (Maybe Text -> f (Maybe Text)) -> SamplingRule -> f SamplingRule
samplingRule_ruleARN = (SamplingRule -> Maybe Text)
-> (SamplingRule -> Maybe Text -> SamplingRule)
-> Lens SamplingRule SamplingRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Maybe Text
ruleARN :: Maybe Text
$sel:ruleARN:SamplingRule' :: SamplingRule -> Maybe Text
ruleARN} -> Maybe Text
ruleARN) (\s :: SamplingRule
s@SamplingRule' {} Maybe Text
a -> SamplingRule
s {$sel:ruleARN:SamplingRule' :: Maybe Text
ruleARN = Maybe Text
a} :: SamplingRule)
samplingRule_resourceARN :: Lens.Lens' SamplingRule Prelude.Text
samplingRule_resourceARN :: (Text -> f Text) -> SamplingRule -> f SamplingRule
samplingRule_resourceARN = (SamplingRule -> Text)
-> (SamplingRule -> Text -> SamplingRule)
-> Lens SamplingRule SamplingRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Text
resourceARN :: Text
$sel:resourceARN:SamplingRule' :: SamplingRule -> Text
resourceARN} -> Text
resourceARN) (\s :: SamplingRule
s@SamplingRule' {} Text
a -> SamplingRule
s {$sel:resourceARN:SamplingRule' :: Text
resourceARN = Text
a} :: SamplingRule)
samplingRule_priority :: Lens.Lens' SamplingRule Prelude.Natural
samplingRule_priority :: (Natural -> f Natural) -> SamplingRule -> f SamplingRule
samplingRule_priority = (SamplingRule -> Natural)
-> (SamplingRule -> Natural -> SamplingRule)
-> Lens SamplingRule SamplingRule Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Natural
priority :: Natural
$sel:priority:SamplingRule' :: SamplingRule -> Natural
priority} -> Natural
priority) (\s :: SamplingRule
s@SamplingRule' {} Natural
a -> SamplingRule
s {$sel:priority:SamplingRule' :: Natural
priority = Natural
a} :: SamplingRule)
samplingRule_fixedRate :: Lens.Lens' SamplingRule Prelude.Double
samplingRule_fixedRate :: (Double -> f Double) -> SamplingRule -> f SamplingRule
samplingRule_fixedRate = (SamplingRule -> Double)
-> (SamplingRule -> Double -> SamplingRule)
-> Lens SamplingRule SamplingRule Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Double
fixedRate :: Double
$sel:fixedRate:SamplingRule' :: SamplingRule -> Double
fixedRate} -> Double
fixedRate) (\s :: SamplingRule
s@SamplingRule' {} Double
a -> SamplingRule
s {$sel:fixedRate:SamplingRule' :: Double
fixedRate = Double
a} :: SamplingRule)
samplingRule_reservoirSize :: Lens.Lens' SamplingRule Prelude.Natural
samplingRule_reservoirSize :: (Natural -> f Natural) -> SamplingRule -> f SamplingRule
samplingRule_reservoirSize = (SamplingRule -> Natural)
-> (SamplingRule -> Natural -> SamplingRule)
-> Lens SamplingRule SamplingRule Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Natural
reservoirSize :: Natural
$sel:reservoirSize:SamplingRule' :: SamplingRule -> Natural
reservoirSize} -> Natural
reservoirSize) (\s :: SamplingRule
s@SamplingRule' {} Natural
a -> SamplingRule
s {$sel:reservoirSize:SamplingRule' :: Natural
reservoirSize = Natural
a} :: SamplingRule)
samplingRule_serviceName :: Lens.Lens' SamplingRule Prelude.Text
samplingRule_serviceName :: (Text -> f Text) -> SamplingRule -> f SamplingRule
samplingRule_serviceName = (SamplingRule -> Text)
-> (SamplingRule -> Text -> SamplingRule)
-> Lens SamplingRule SamplingRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Text
serviceName :: Text
$sel:serviceName:SamplingRule' :: SamplingRule -> Text
serviceName} -> Text
serviceName) (\s :: SamplingRule
s@SamplingRule' {} Text
a -> SamplingRule
s {$sel:serviceName:SamplingRule' :: Text
serviceName = Text
a} :: SamplingRule)
samplingRule_serviceType :: Lens.Lens' SamplingRule Prelude.Text
samplingRule_serviceType :: (Text -> f Text) -> SamplingRule -> f SamplingRule
samplingRule_serviceType = (SamplingRule -> Text)
-> (SamplingRule -> Text -> SamplingRule)
-> Lens SamplingRule SamplingRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Text
serviceType :: Text
$sel:serviceType:SamplingRule' :: SamplingRule -> Text
serviceType} -> Text
serviceType) (\s :: SamplingRule
s@SamplingRule' {} Text
a -> SamplingRule
s {$sel:serviceType:SamplingRule' :: Text
serviceType = Text
a} :: SamplingRule)
samplingRule_host :: Lens.Lens' SamplingRule Prelude.Text
samplingRule_host :: (Text -> f Text) -> SamplingRule -> f SamplingRule
samplingRule_host = (SamplingRule -> Text)
-> (SamplingRule -> Text -> SamplingRule)
-> Lens SamplingRule SamplingRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Text
host :: Text
$sel:host:SamplingRule' :: SamplingRule -> Text
host} -> Text
host) (\s :: SamplingRule
s@SamplingRule' {} Text
a -> SamplingRule
s {$sel:host:SamplingRule' :: Text
host = Text
a} :: SamplingRule)
samplingRule_hTTPMethod :: Lens.Lens' SamplingRule Prelude.Text
samplingRule_hTTPMethod :: (Text -> f Text) -> SamplingRule -> f SamplingRule
samplingRule_hTTPMethod = (SamplingRule -> Text)
-> (SamplingRule -> Text -> SamplingRule)
-> Lens SamplingRule SamplingRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Text
hTTPMethod :: Text
$sel:hTTPMethod:SamplingRule' :: SamplingRule -> Text
hTTPMethod} -> Text
hTTPMethod) (\s :: SamplingRule
s@SamplingRule' {} Text
a -> SamplingRule
s {$sel:hTTPMethod:SamplingRule' :: Text
hTTPMethod = Text
a} :: SamplingRule)
samplingRule_uRLPath :: Lens.Lens' SamplingRule Prelude.Text
samplingRule_uRLPath :: (Text -> f Text) -> SamplingRule -> f SamplingRule
samplingRule_uRLPath = (SamplingRule -> Text)
-> (SamplingRule -> Text -> SamplingRule)
-> Lens SamplingRule SamplingRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Text
uRLPath :: Text
$sel:uRLPath:SamplingRule' :: SamplingRule -> Text
uRLPath} -> Text
uRLPath) (\s :: SamplingRule
s@SamplingRule' {} Text
a -> SamplingRule
s {$sel:uRLPath:SamplingRule' :: Text
uRLPath = Text
a} :: SamplingRule)
samplingRule_version :: Lens.Lens' SamplingRule Prelude.Natural
samplingRule_version :: (Natural -> f Natural) -> SamplingRule -> f SamplingRule
samplingRule_version = (SamplingRule -> Natural)
-> (SamplingRule -> Natural -> SamplingRule)
-> Lens SamplingRule SamplingRule Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamplingRule' {Natural
version :: Natural
$sel:version:SamplingRule' :: SamplingRule -> Natural
version} -> Natural
version) (\s :: SamplingRule
s@SamplingRule' {} Natural
a -> SamplingRule
s {$sel:version:SamplingRule' :: Natural
version = Natural
a} :: SamplingRule)
instance Core.FromJSON SamplingRule where
parseJSON :: Value -> Parser SamplingRule
parseJSON =
String
-> (Object -> Parser SamplingRule) -> Value -> Parser SamplingRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SamplingRule"
( \Object
x ->
Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Text
-> Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule
SamplingRule'
(Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Text
-> Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
-> Parser (Maybe Text)
-> Parser
(Maybe (HashMap Text Text)
-> Maybe Text
-> Text
-> Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
forall (f :: * -> *) a b. Functor 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
"RuleName")
Parser
(Maybe (HashMap Text Text)
-> Maybe Text
-> Text
-> Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
-> Parser (Maybe (HashMap Text Text))
-> Parser
(Maybe Text
-> Text
-> Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Attributes" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Text
-> Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
-> Parser (Maybe Text)
-> Parser
(Text
-> Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
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
"RuleARN")
Parser
(Text
-> Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
-> Parser Text
-> Parser
(Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
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
"ResourceARN")
Parser
(Natural
-> Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
-> Parser Natural
-> Parser
(Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Priority")
Parser
(Double
-> Natural
-> Text
-> Text
-> Text
-> Text
-> Text
-> Natural
-> SamplingRule)
-> Parser Double
-> Parser
(Natural
-> Text -> Text -> Text -> Text -> Text -> Natural -> SamplingRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"FixedRate")
Parser
(Natural
-> Text -> Text -> Text -> Text -> Text -> Natural -> SamplingRule)
-> Parser Natural
-> Parser
(Text -> Text -> Text -> Text -> Text -> Natural -> SamplingRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ReservoirSize")
Parser
(Text -> Text -> Text -> Text -> Text -> Natural -> SamplingRule)
-> Parser Text
-> Parser (Text -> Text -> Text -> Text -> Natural -> SamplingRule)
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
"ServiceName")
Parser (Text -> Text -> Text -> Text -> Natural -> SamplingRule)
-> Parser Text
-> Parser (Text -> Text -> Text -> Natural -> SamplingRule)
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
"ServiceType")
Parser (Text -> Text -> Text -> Natural -> SamplingRule)
-> Parser Text -> Parser (Text -> Text -> Natural -> SamplingRule)
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
"Host")
Parser (Text -> Text -> Natural -> SamplingRule)
-> Parser Text -> Parser (Text -> Natural -> SamplingRule)
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
"HTTPMethod")
Parser (Text -> Natural -> SamplingRule)
-> Parser Text -> Parser (Natural -> SamplingRule)
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
"URLPath")
Parser (Natural -> SamplingRule)
-> Parser Natural -> Parser SamplingRule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Version")
)
instance Prelude.Hashable SamplingRule
instance Prelude.NFData SamplingRule
instance Core.ToJSON SamplingRule where
toJSON :: SamplingRule -> Value
toJSON SamplingRule' {Double
Natural
Maybe Text
Maybe (HashMap Text Text)
Text
version :: Natural
uRLPath :: Text
hTTPMethod :: Text
host :: Text
serviceType :: Text
serviceName :: Text
reservoirSize :: Natural
fixedRate :: Double
priority :: Natural
resourceARN :: Text
ruleARN :: Maybe Text
attributes :: Maybe (HashMap Text Text)
ruleName :: Maybe Text
$sel:version:SamplingRule' :: SamplingRule -> Natural
$sel:uRLPath:SamplingRule' :: SamplingRule -> Text
$sel:hTTPMethod:SamplingRule' :: SamplingRule -> Text
$sel:host:SamplingRule' :: SamplingRule -> Text
$sel:serviceType:SamplingRule' :: SamplingRule -> Text
$sel:serviceName:SamplingRule' :: SamplingRule -> Text
$sel:reservoirSize:SamplingRule' :: SamplingRule -> Natural
$sel:fixedRate:SamplingRule' :: SamplingRule -> Double
$sel:priority:SamplingRule' :: SamplingRule -> Natural
$sel:resourceARN:SamplingRule' :: SamplingRule -> Text
$sel:ruleARN:SamplingRule' :: SamplingRule -> Maybe Text
$sel:attributes:SamplingRule' :: SamplingRule -> Maybe (HashMap Text Text)
$sel:ruleName:SamplingRule' :: SamplingRule -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RuleName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ruleName,
(Text
"Attributes" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
attributes,
(Text
"RuleARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ruleARN,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceARN),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Priority" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
priority),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FixedRate" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Double
fixedRate),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ReservoirSize" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
reservoirSize),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServiceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServiceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Host" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
host),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HTTPMethod" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
hTTPMethod),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"URLPath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
uRLPath),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Version" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
version)
]
)