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