{-# 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.DataBrew.Types.Threshold where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataBrew.Types.ThresholdType
import Amazonka.DataBrew.Types.ThresholdUnit
import qualified Amazonka.Prelude as Prelude
data Threshold = Threshold'
{
Threshold -> Maybe ThresholdType
type' :: Prelude.Maybe ThresholdType,
Threshold -> Maybe ThresholdUnit
unit :: Prelude.Maybe ThresholdUnit,
Threshold -> Double
value :: Prelude.Double
}
deriving (Threshold -> Threshold -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Threshold -> Threshold -> Bool
$c/= :: Threshold -> Threshold -> Bool
== :: Threshold -> Threshold -> Bool
$c== :: Threshold -> Threshold -> Bool
Prelude.Eq, ReadPrec [Threshold]
ReadPrec Threshold
Int -> ReadS Threshold
ReadS [Threshold]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Threshold]
$creadListPrec :: ReadPrec [Threshold]
readPrec :: ReadPrec Threshold
$creadPrec :: ReadPrec Threshold
readList :: ReadS [Threshold]
$creadList :: ReadS [Threshold]
readsPrec :: Int -> ReadS Threshold
$creadsPrec :: Int -> ReadS Threshold
Prelude.Read, Int -> Threshold -> ShowS
[Threshold] -> ShowS
Threshold -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Threshold] -> ShowS
$cshowList :: [Threshold] -> ShowS
show :: Threshold -> String
$cshow :: Threshold -> String
showsPrec :: Int -> Threshold -> ShowS
$cshowsPrec :: Int -> Threshold -> ShowS
Prelude.Show, forall x. Rep Threshold x -> Threshold
forall x. Threshold -> Rep Threshold x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Threshold x -> Threshold
$cfrom :: forall x. Threshold -> Rep Threshold x
Prelude.Generic)
newThreshold ::
Prelude.Double ->
Threshold
newThreshold :: Double -> Threshold
newThreshold Double
pValue_ =
Threshold'
{ $sel:type':Threshold' :: Maybe ThresholdType
type' = forall a. Maybe a
Prelude.Nothing,
$sel:unit:Threshold' :: Maybe ThresholdUnit
unit = forall a. Maybe a
Prelude.Nothing,
$sel:value:Threshold' :: Double
value = Double
pValue_
}
threshold_type :: Lens.Lens' Threshold (Prelude.Maybe ThresholdType)
threshold_type :: Lens' Threshold (Maybe ThresholdType)
threshold_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Threshold' {Maybe ThresholdType
type' :: Maybe ThresholdType
$sel:type':Threshold' :: Threshold -> Maybe ThresholdType
type'} -> Maybe ThresholdType
type') (\s :: Threshold
s@Threshold' {} Maybe ThresholdType
a -> Threshold
s {$sel:type':Threshold' :: Maybe ThresholdType
type' = Maybe ThresholdType
a} :: Threshold)
threshold_unit :: Lens.Lens' Threshold (Prelude.Maybe ThresholdUnit)
threshold_unit :: Lens' Threshold (Maybe ThresholdUnit)
threshold_unit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Threshold' {Maybe ThresholdUnit
unit :: Maybe ThresholdUnit
$sel:unit:Threshold' :: Threshold -> Maybe ThresholdUnit
unit} -> Maybe ThresholdUnit
unit) (\s :: Threshold
s@Threshold' {} Maybe ThresholdUnit
a -> Threshold
s {$sel:unit:Threshold' :: Maybe ThresholdUnit
unit = Maybe ThresholdUnit
a} :: Threshold)
threshold_value :: Lens.Lens' Threshold Prelude.Double
threshold_value :: Lens' Threshold Double
threshold_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Threshold' {Double
value :: Double
$sel:value:Threshold' :: Threshold -> Double
value} -> Double
value) (\s :: Threshold
s@Threshold' {} Double
a -> Threshold
s {$sel:value:Threshold' :: Double
value = Double
a} :: Threshold)
instance Data.FromJSON Threshold where
parseJSON :: Value -> Parser Threshold
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Threshold"
( \Object
x ->
Maybe ThresholdType -> Maybe ThresholdUnit -> Double -> Threshold
Threshold'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Type")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Unit")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Value")
)
instance Prelude.Hashable Threshold where
hashWithSalt :: Int -> Threshold -> Int
hashWithSalt Int
_salt Threshold' {Double
Maybe ThresholdType
Maybe ThresholdUnit
value :: Double
unit :: Maybe ThresholdUnit
type' :: Maybe ThresholdType
$sel:value:Threshold' :: Threshold -> Double
$sel:unit:Threshold' :: Threshold -> Maybe ThresholdUnit
$sel:type':Threshold' :: Threshold -> Maybe ThresholdType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ThresholdType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ThresholdUnit
unit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
value
instance Prelude.NFData Threshold where
rnf :: Threshold -> ()
rnf Threshold' {Double
Maybe ThresholdType
Maybe ThresholdUnit
value :: Double
unit :: Maybe ThresholdUnit
type' :: Maybe ThresholdType
$sel:value:Threshold' :: Threshold -> Double
$sel:unit:Threshold' :: Threshold -> Maybe ThresholdUnit
$sel:type':Threshold' :: Threshold -> Maybe ThresholdType
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ThresholdType
type'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ThresholdUnit
unit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
value
instance Data.ToJSON Threshold where
toJSON :: Threshold -> Value
toJSON Threshold' {Double
Maybe ThresholdType
Maybe ThresholdUnit
value :: Double
unit :: Maybe ThresholdUnit
type' :: Maybe ThresholdType
$sel:value:Threshold' :: Threshold -> Double
$sel:unit:Threshold' :: Threshold -> Maybe ThresholdUnit
$sel:type':Threshold' :: Threshold -> Maybe ThresholdType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Type" 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 ThresholdType
type',
(Key
"Unit" 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 ThresholdUnit
unit,
forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
value)
]
)