{-# 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.ECS.Types.Scale where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECS.Types.ScaleUnit
import qualified Amazonka.Prelude as Prelude
data Scale = Scale'
{
Scale -> Maybe ScaleUnit
unit :: Prelude.Maybe ScaleUnit,
Scale -> Maybe Double
value :: Prelude.Maybe Prelude.Double
}
deriving (Scale -> Scale -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scale -> Scale -> Bool
$c/= :: Scale -> Scale -> Bool
== :: Scale -> Scale -> Bool
$c== :: Scale -> Scale -> Bool
Prelude.Eq, ReadPrec [Scale]
ReadPrec Scale
Int -> ReadS Scale
ReadS [Scale]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Scale]
$creadListPrec :: ReadPrec [Scale]
readPrec :: ReadPrec Scale
$creadPrec :: ReadPrec Scale
readList :: ReadS [Scale]
$creadList :: ReadS [Scale]
readsPrec :: Int -> ReadS Scale
$creadsPrec :: Int -> ReadS Scale
Prelude.Read, Int -> Scale -> ShowS
[Scale] -> ShowS
Scale -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scale] -> ShowS
$cshowList :: [Scale] -> ShowS
show :: Scale -> String
$cshow :: Scale -> String
showsPrec :: Int -> Scale -> ShowS
$cshowsPrec :: Int -> Scale -> ShowS
Prelude.Show, forall x. Rep Scale x -> Scale
forall x. Scale -> Rep Scale x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Scale x -> Scale
$cfrom :: forall x. Scale -> Rep Scale x
Prelude.Generic)
newScale ::
Scale
newScale :: Scale
newScale =
Scale'
{ $sel:unit:Scale' :: Maybe ScaleUnit
unit = forall a. Maybe a
Prelude.Nothing,
$sel:value:Scale' :: Maybe Double
value = forall a. Maybe a
Prelude.Nothing
}
scale_unit :: Lens.Lens' Scale (Prelude.Maybe ScaleUnit)
scale_unit :: Lens' Scale (Maybe ScaleUnit)
scale_unit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scale' {Maybe ScaleUnit
unit :: Maybe ScaleUnit
$sel:unit:Scale' :: Scale -> Maybe ScaleUnit
unit} -> Maybe ScaleUnit
unit) (\s :: Scale
s@Scale' {} Maybe ScaleUnit
a -> Scale
s {$sel:unit:Scale' :: Maybe ScaleUnit
unit = Maybe ScaleUnit
a} :: Scale)
scale_value :: Lens.Lens' Scale (Prelude.Maybe Prelude.Double)
scale_value :: Lens' Scale (Maybe Double)
scale_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scale' {Maybe Double
value :: Maybe Double
$sel:value:Scale' :: Scale -> Maybe Double
value} -> Maybe Double
value) (\s :: Scale
s@Scale' {} Maybe Double
a -> Scale
s {$sel:value:Scale' :: Maybe Double
value = Maybe Double
a} :: Scale)
instance Data.FromJSON Scale where
parseJSON :: Value -> Parser Scale
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Scale"
( \Object
x ->
Maybe ScaleUnit -> Maybe Double -> Scale
Scale'
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
"unit")
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
"value")
)
instance Prelude.Hashable Scale where
hashWithSalt :: Int -> Scale -> Int
hashWithSalt Int
_salt Scale' {Maybe Double
Maybe ScaleUnit
value :: Maybe Double
unit :: Maybe ScaleUnit
$sel:value:Scale' :: Scale -> Maybe Double
$sel:unit:Scale' :: Scale -> Maybe ScaleUnit
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScaleUnit
unit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
value
instance Prelude.NFData Scale where
rnf :: Scale -> ()
rnf Scale' {Maybe Double
Maybe ScaleUnit
value :: Maybe Double
unit :: Maybe ScaleUnit
$sel:value:Scale' :: Scale -> Maybe Double
$sel:unit:Scale' :: Scale -> Maybe ScaleUnit
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ScaleUnit
unit seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
value
instance Data.ToJSON Scale where
toJSON :: Scale -> Value
toJSON Scale' {Maybe Double
Maybe ScaleUnit
value :: Maybe Double
unit :: Maybe ScaleUnit
$sel:value:Scale' :: Scale -> Maybe Double
$sel:unit:Scale' :: Scale -> Maybe ScaleUnit
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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 ScaleUnit
unit,
(Key
"value" 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 Double
value
]
)