{-# 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.GreengrassV2.Types.SystemResourceLimits where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SystemResourceLimits = SystemResourceLimits'
{
SystemResourceLimits -> Maybe Natural
memory :: Prelude.Maybe Prelude.Natural,
SystemResourceLimits -> Maybe Double
cpus :: Prelude.Maybe Prelude.Double
}
deriving (SystemResourceLimits -> SystemResourceLimits -> Bool
(SystemResourceLimits -> SystemResourceLimits -> Bool)
-> (SystemResourceLimits -> SystemResourceLimits -> Bool)
-> Eq SystemResourceLimits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SystemResourceLimits -> SystemResourceLimits -> Bool
$c/= :: SystemResourceLimits -> SystemResourceLimits -> Bool
== :: SystemResourceLimits -> SystemResourceLimits -> Bool
$c== :: SystemResourceLimits -> SystemResourceLimits -> Bool
Prelude.Eq, ReadPrec [SystemResourceLimits]
ReadPrec SystemResourceLimits
Int -> ReadS SystemResourceLimits
ReadS [SystemResourceLimits]
(Int -> ReadS SystemResourceLimits)
-> ReadS [SystemResourceLimits]
-> ReadPrec SystemResourceLimits
-> ReadPrec [SystemResourceLimits]
-> Read SystemResourceLimits
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SystemResourceLimits]
$creadListPrec :: ReadPrec [SystemResourceLimits]
readPrec :: ReadPrec SystemResourceLimits
$creadPrec :: ReadPrec SystemResourceLimits
readList :: ReadS [SystemResourceLimits]
$creadList :: ReadS [SystemResourceLimits]
readsPrec :: Int -> ReadS SystemResourceLimits
$creadsPrec :: Int -> ReadS SystemResourceLimits
Prelude.Read, Int -> SystemResourceLimits -> ShowS
[SystemResourceLimits] -> ShowS
SystemResourceLimits -> String
(Int -> SystemResourceLimits -> ShowS)
-> (SystemResourceLimits -> String)
-> ([SystemResourceLimits] -> ShowS)
-> Show SystemResourceLimits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SystemResourceLimits] -> ShowS
$cshowList :: [SystemResourceLimits] -> ShowS
show :: SystemResourceLimits -> String
$cshow :: SystemResourceLimits -> String
showsPrec :: Int -> SystemResourceLimits -> ShowS
$cshowsPrec :: Int -> SystemResourceLimits -> ShowS
Prelude.Show, (forall x. SystemResourceLimits -> Rep SystemResourceLimits x)
-> (forall x. Rep SystemResourceLimits x -> SystemResourceLimits)
-> Generic SystemResourceLimits
forall x. Rep SystemResourceLimits x -> SystemResourceLimits
forall x. SystemResourceLimits -> Rep SystemResourceLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SystemResourceLimits x -> SystemResourceLimits
$cfrom :: forall x. SystemResourceLimits -> Rep SystemResourceLimits x
Prelude.Generic)
newSystemResourceLimits ::
SystemResourceLimits
newSystemResourceLimits :: SystemResourceLimits
newSystemResourceLimits =
SystemResourceLimits' :: Maybe Natural -> Maybe Double -> SystemResourceLimits
SystemResourceLimits'
{ $sel:memory:SystemResourceLimits' :: Maybe Natural
memory = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:cpus:SystemResourceLimits' :: Maybe Double
cpus = Maybe Double
forall a. Maybe a
Prelude.Nothing
}
systemResourceLimits_memory :: Lens.Lens' SystemResourceLimits (Prelude.Maybe Prelude.Natural)
systemResourceLimits_memory :: (Maybe Natural -> f (Maybe Natural))
-> SystemResourceLimits -> f SystemResourceLimits
systemResourceLimits_memory = (SystemResourceLimits -> Maybe Natural)
-> (SystemResourceLimits -> Maybe Natural -> SystemResourceLimits)
-> Lens
SystemResourceLimits
SystemResourceLimits
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SystemResourceLimits' {Maybe Natural
memory :: Maybe Natural
$sel:memory:SystemResourceLimits' :: SystemResourceLimits -> Maybe Natural
memory} -> Maybe Natural
memory) (\s :: SystemResourceLimits
s@SystemResourceLimits' {} Maybe Natural
a -> SystemResourceLimits
s {$sel:memory:SystemResourceLimits' :: Maybe Natural
memory = Maybe Natural
a} :: SystemResourceLimits)
systemResourceLimits_cpus :: Lens.Lens' SystemResourceLimits (Prelude.Maybe Prelude.Double)
systemResourceLimits_cpus :: (Maybe Double -> f (Maybe Double))
-> SystemResourceLimits -> f SystemResourceLimits
systemResourceLimits_cpus = (SystemResourceLimits -> Maybe Double)
-> (SystemResourceLimits -> Maybe Double -> SystemResourceLimits)
-> Lens
SystemResourceLimits
SystemResourceLimits
(Maybe Double)
(Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SystemResourceLimits' {Maybe Double
cpus :: Maybe Double
$sel:cpus:SystemResourceLimits' :: SystemResourceLimits -> Maybe Double
cpus} -> Maybe Double
cpus) (\s :: SystemResourceLimits
s@SystemResourceLimits' {} Maybe Double
a -> SystemResourceLimits
s {$sel:cpus:SystemResourceLimits' :: Maybe Double
cpus = Maybe Double
a} :: SystemResourceLimits)
instance Core.FromJSON SystemResourceLimits where
parseJSON :: Value -> Parser SystemResourceLimits
parseJSON =
String
-> (Object -> Parser SystemResourceLimits)
-> Value
-> Parser SystemResourceLimits
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SystemResourceLimits"
( \Object
x ->
Maybe Natural -> Maybe Double -> SystemResourceLimits
SystemResourceLimits'
(Maybe Natural -> Maybe Double -> SystemResourceLimits)
-> Parser (Maybe Natural)
-> Parser (Maybe Double -> SystemResourceLimits)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"memory")
Parser (Maybe Double -> SystemResourceLimits)
-> Parser (Maybe Double) -> Parser SystemResourceLimits
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cpus")
)
instance Prelude.Hashable SystemResourceLimits
instance Prelude.NFData SystemResourceLimits
instance Core.ToJSON SystemResourceLimits where
toJSON :: SystemResourceLimits -> Value
toJSON SystemResourceLimits' {Maybe Double
Maybe Natural
cpus :: Maybe Double
memory :: Maybe Natural
$sel:cpus:SystemResourceLimits' :: SystemResourceLimits -> Maybe Double
$sel:memory:SystemResourceLimits' :: SystemResourceLimits -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"memory" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
memory,
(Text
"cpus" 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
cpus
]
)