{-# 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.Forecast.Types.IntegerParameterRange where
import qualified Amazonka.Core as Core
import Amazonka.Forecast.Types.ScalingType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data IntegerParameterRange = IntegerParameterRange'
{
IntegerParameterRange -> Maybe ScalingType
scalingType :: Prelude.Maybe ScalingType,
IntegerParameterRange -> Text
name :: Prelude.Text,
IntegerParameterRange -> Int
maxValue :: Prelude.Int,
IntegerParameterRange -> Int
minValue :: Prelude.Int
}
deriving (IntegerParameterRange -> IntegerParameterRange -> Bool
(IntegerParameterRange -> IntegerParameterRange -> Bool)
-> (IntegerParameterRange -> IntegerParameterRange -> Bool)
-> Eq IntegerParameterRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IntegerParameterRange -> IntegerParameterRange -> Bool
$c/= :: IntegerParameterRange -> IntegerParameterRange -> Bool
== :: IntegerParameterRange -> IntegerParameterRange -> Bool
$c== :: IntegerParameterRange -> IntegerParameterRange -> Bool
Prelude.Eq, ReadPrec [IntegerParameterRange]
ReadPrec IntegerParameterRange
Int -> ReadS IntegerParameterRange
ReadS [IntegerParameterRange]
(Int -> ReadS IntegerParameterRange)
-> ReadS [IntegerParameterRange]
-> ReadPrec IntegerParameterRange
-> ReadPrec [IntegerParameterRange]
-> Read IntegerParameterRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IntegerParameterRange]
$creadListPrec :: ReadPrec [IntegerParameterRange]
readPrec :: ReadPrec IntegerParameterRange
$creadPrec :: ReadPrec IntegerParameterRange
readList :: ReadS [IntegerParameterRange]
$creadList :: ReadS [IntegerParameterRange]
readsPrec :: Int -> ReadS IntegerParameterRange
$creadsPrec :: Int -> ReadS IntegerParameterRange
Prelude.Read, Int -> IntegerParameterRange -> ShowS
[IntegerParameterRange] -> ShowS
IntegerParameterRange -> String
(Int -> IntegerParameterRange -> ShowS)
-> (IntegerParameterRange -> String)
-> ([IntegerParameterRange] -> ShowS)
-> Show IntegerParameterRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IntegerParameterRange] -> ShowS
$cshowList :: [IntegerParameterRange] -> ShowS
show :: IntegerParameterRange -> String
$cshow :: IntegerParameterRange -> String
showsPrec :: Int -> IntegerParameterRange -> ShowS
$cshowsPrec :: Int -> IntegerParameterRange -> ShowS
Prelude.Show, (forall x. IntegerParameterRange -> Rep IntegerParameterRange x)
-> (forall x. Rep IntegerParameterRange x -> IntegerParameterRange)
-> Generic IntegerParameterRange
forall x. Rep IntegerParameterRange x -> IntegerParameterRange
forall x. IntegerParameterRange -> Rep IntegerParameterRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IntegerParameterRange x -> IntegerParameterRange
$cfrom :: forall x. IntegerParameterRange -> Rep IntegerParameterRange x
Prelude.Generic)
newIntegerParameterRange ::
Prelude.Text ->
Prelude.Int ->
Prelude.Int ->
IntegerParameterRange
newIntegerParameterRange :: Text -> Int -> Int -> IntegerParameterRange
newIntegerParameterRange Text
pName_ Int
pMaxValue_ Int
pMinValue_ =
IntegerParameterRange' :: Maybe ScalingType -> Text -> Int -> Int -> IntegerParameterRange
IntegerParameterRange'
{ $sel:scalingType:IntegerParameterRange' :: Maybe ScalingType
scalingType =
Maybe ScalingType
forall a. Maybe a
Prelude.Nothing,
$sel:name:IntegerParameterRange' :: Text
name = Text
pName_,
$sel:maxValue:IntegerParameterRange' :: Int
maxValue = Int
pMaxValue_,
$sel:minValue:IntegerParameterRange' :: Int
minValue = Int
pMinValue_
}
integerParameterRange_scalingType :: Lens.Lens' IntegerParameterRange (Prelude.Maybe ScalingType)
integerParameterRange_scalingType :: (Maybe ScalingType -> f (Maybe ScalingType))
-> IntegerParameterRange -> f IntegerParameterRange
integerParameterRange_scalingType = (IntegerParameterRange -> Maybe ScalingType)
-> (IntegerParameterRange
-> Maybe ScalingType -> IntegerParameterRange)
-> Lens
IntegerParameterRange
IntegerParameterRange
(Maybe ScalingType)
(Maybe ScalingType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntegerParameterRange' {Maybe ScalingType
scalingType :: Maybe ScalingType
$sel:scalingType:IntegerParameterRange' :: IntegerParameterRange -> Maybe ScalingType
scalingType} -> Maybe ScalingType
scalingType) (\s :: IntegerParameterRange
s@IntegerParameterRange' {} Maybe ScalingType
a -> IntegerParameterRange
s {$sel:scalingType:IntegerParameterRange' :: Maybe ScalingType
scalingType = Maybe ScalingType
a} :: IntegerParameterRange)
integerParameterRange_name :: Lens.Lens' IntegerParameterRange Prelude.Text
integerParameterRange_name :: (Text -> f Text)
-> IntegerParameterRange -> f IntegerParameterRange
integerParameterRange_name = (IntegerParameterRange -> Text)
-> (IntegerParameterRange -> Text -> IntegerParameterRange)
-> Lens IntegerParameterRange IntegerParameterRange Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntegerParameterRange' {Text
name :: Text
$sel:name:IntegerParameterRange' :: IntegerParameterRange -> Text
name} -> Text
name) (\s :: IntegerParameterRange
s@IntegerParameterRange' {} Text
a -> IntegerParameterRange
s {$sel:name:IntegerParameterRange' :: Text
name = Text
a} :: IntegerParameterRange)
integerParameterRange_maxValue :: Lens.Lens' IntegerParameterRange Prelude.Int
integerParameterRange_maxValue :: (Int -> f Int) -> IntegerParameterRange -> f IntegerParameterRange
integerParameterRange_maxValue = (IntegerParameterRange -> Int)
-> (IntegerParameterRange -> Int -> IntegerParameterRange)
-> Lens IntegerParameterRange IntegerParameterRange Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntegerParameterRange' {Int
maxValue :: Int
$sel:maxValue:IntegerParameterRange' :: IntegerParameterRange -> Int
maxValue} -> Int
maxValue) (\s :: IntegerParameterRange
s@IntegerParameterRange' {} Int
a -> IntegerParameterRange
s {$sel:maxValue:IntegerParameterRange' :: Int
maxValue = Int
a} :: IntegerParameterRange)
integerParameterRange_minValue :: Lens.Lens' IntegerParameterRange Prelude.Int
integerParameterRange_minValue :: (Int -> f Int) -> IntegerParameterRange -> f IntegerParameterRange
integerParameterRange_minValue = (IntegerParameterRange -> Int)
-> (IntegerParameterRange -> Int -> IntegerParameterRange)
-> Lens IntegerParameterRange IntegerParameterRange Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IntegerParameterRange' {Int
minValue :: Int
$sel:minValue:IntegerParameterRange' :: IntegerParameterRange -> Int
minValue} -> Int
minValue) (\s :: IntegerParameterRange
s@IntegerParameterRange' {} Int
a -> IntegerParameterRange
s {$sel:minValue:IntegerParameterRange' :: Int
minValue = Int
a} :: IntegerParameterRange)
instance Core.FromJSON IntegerParameterRange where
parseJSON :: Value -> Parser IntegerParameterRange
parseJSON =
String
-> (Object -> Parser IntegerParameterRange)
-> Value
-> Parser IntegerParameterRange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IntegerParameterRange"
( \Object
x ->
Maybe ScalingType -> Text -> Int -> Int -> IntegerParameterRange
IntegerParameterRange'
(Maybe ScalingType -> Text -> Int -> Int -> IntegerParameterRange)
-> Parser (Maybe ScalingType)
-> Parser (Text -> Int -> Int -> IntegerParameterRange)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ScalingType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScalingType")
Parser (Text -> Int -> Int -> IntegerParameterRange)
-> Parser Text -> Parser (Int -> Int -> IntegerParameterRange)
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
"Name")
Parser (Int -> Int -> IntegerParameterRange)
-> Parser Int -> Parser (Int -> IntegerParameterRange)
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
"MaxValue")
Parser (Int -> IntegerParameterRange)
-> Parser Int -> Parser IntegerParameterRange
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
"MinValue")
)
instance Prelude.Hashable IntegerParameterRange
instance Prelude.NFData IntegerParameterRange
instance Core.ToJSON IntegerParameterRange where
toJSON :: IntegerParameterRange -> Value
toJSON IntegerParameterRange' {Int
Maybe ScalingType
Text
minValue :: Int
maxValue :: Int
name :: Text
scalingType :: Maybe ScalingType
$sel:minValue:IntegerParameterRange' :: IntegerParameterRange -> Int
$sel:maxValue:IntegerParameterRange' :: IntegerParameterRange -> Int
$sel:name:IntegerParameterRange' :: IntegerParameterRange -> Text
$sel:scalingType:IntegerParameterRange' :: IntegerParameterRange -> Maybe ScalingType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ScalingType" Text -> ScalingType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ScalingType -> Pair) -> Maybe ScalingType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScalingType
scalingType,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MaxValue" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
maxValue),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MinValue" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
minValue)
]
)