{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.RobOMaker.Types.ComputeResponse
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.RobOMaker.Types.ComputeResponse where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RobOMaker.Types.ComputeType

-- | Compute information for the simulation job
--
-- /See:/ 'newComputeResponse' smart constructor.
data ComputeResponse = ComputeResponse'
  { -- | The simulation unit limit. Your simulation is allocated CPU and memory
    -- proportional to the supplied simulation unit limit. A simulation unit is
    -- 1 vcpu and 2GB of memory. You are only billed for the SU utilization you
    -- consume up to the maximum value provided. The default is 15.
    ComputeResponse -> Maybe Natural
simulationUnitLimit :: Prelude.Maybe Prelude.Natural,
    -- | Compute GPU unit limit for the simulation job. It is the same as the
    -- number of GPUs allocated to the SimulationJob.
    ComputeResponse -> Maybe Natural
gpuUnitLimit :: Prelude.Maybe Prelude.Natural,
    -- | Compute type response information for the simulation job.
    ComputeResponse -> Maybe ComputeType
computeType :: Prelude.Maybe ComputeType
  }
  deriving (ComputeResponse -> ComputeResponse -> Bool
(ComputeResponse -> ComputeResponse -> Bool)
-> (ComputeResponse -> ComputeResponse -> Bool)
-> Eq ComputeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComputeResponse -> ComputeResponse -> Bool
$c/= :: ComputeResponse -> ComputeResponse -> Bool
== :: ComputeResponse -> ComputeResponse -> Bool
$c== :: ComputeResponse -> ComputeResponse -> Bool
Prelude.Eq, ReadPrec [ComputeResponse]
ReadPrec ComputeResponse
Int -> ReadS ComputeResponse
ReadS [ComputeResponse]
(Int -> ReadS ComputeResponse)
-> ReadS [ComputeResponse]
-> ReadPrec ComputeResponse
-> ReadPrec [ComputeResponse]
-> Read ComputeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComputeResponse]
$creadListPrec :: ReadPrec [ComputeResponse]
readPrec :: ReadPrec ComputeResponse
$creadPrec :: ReadPrec ComputeResponse
readList :: ReadS [ComputeResponse]
$creadList :: ReadS [ComputeResponse]
readsPrec :: Int -> ReadS ComputeResponse
$creadsPrec :: Int -> ReadS ComputeResponse
Prelude.Read, Int -> ComputeResponse -> ShowS
[ComputeResponse] -> ShowS
ComputeResponse -> String
(Int -> ComputeResponse -> ShowS)
-> (ComputeResponse -> String)
-> ([ComputeResponse] -> ShowS)
-> Show ComputeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComputeResponse] -> ShowS
$cshowList :: [ComputeResponse] -> ShowS
show :: ComputeResponse -> String
$cshow :: ComputeResponse -> String
showsPrec :: Int -> ComputeResponse -> ShowS
$cshowsPrec :: Int -> ComputeResponse -> ShowS
Prelude.Show, (forall x. ComputeResponse -> Rep ComputeResponse x)
-> (forall x. Rep ComputeResponse x -> ComputeResponse)
-> Generic ComputeResponse
forall x. Rep ComputeResponse x -> ComputeResponse
forall x. ComputeResponse -> Rep ComputeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComputeResponse x -> ComputeResponse
$cfrom :: forall x. ComputeResponse -> Rep ComputeResponse x
Prelude.Generic)

-- |
-- Create a value of 'ComputeResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'simulationUnitLimit', 'computeResponse_simulationUnitLimit' - The simulation unit limit. Your simulation is allocated CPU and memory
-- proportional to the supplied simulation unit limit. A simulation unit is
-- 1 vcpu and 2GB of memory. You are only billed for the SU utilization you
-- consume up to the maximum value provided. The default is 15.
--
-- 'gpuUnitLimit', 'computeResponse_gpuUnitLimit' - Compute GPU unit limit for the simulation job. It is the same as the
-- number of GPUs allocated to the SimulationJob.
--
-- 'computeType', 'computeResponse_computeType' - Compute type response information for the simulation job.
newComputeResponse ::
  ComputeResponse
newComputeResponse :: ComputeResponse
newComputeResponse =
  ComputeResponse' :: Maybe Natural
-> Maybe Natural -> Maybe ComputeType -> ComputeResponse
ComputeResponse'
    { $sel:simulationUnitLimit:ComputeResponse' :: Maybe Natural
simulationUnitLimit =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:gpuUnitLimit:ComputeResponse' :: Maybe Natural
gpuUnitLimit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:computeType:ComputeResponse' :: Maybe ComputeType
computeType = Maybe ComputeType
forall a. Maybe a
Prelude.Nothing
    }

-- | The simulation unit limit. Your simulation is allocated CPU and memory
-- proportional to the supplied simulation unit limit. A simulation unit is
-- 1 vcpu and 2GB of memory. You are only billed for the SU utilization you
-- consume up to the maximum value provided. The default is 15.
computeResponse_simulationUnitLimit :: Lens.Lens' ComputeResponse (Prelude.Maybe Prelude.Natural)
computeResponse_simulationUnitLimit :: (Maybe Natural -> f (Maybe Natural))
-> ComputeResponse -> f ComputeResponse
computeResponse_simulationUnitLimit = (ComputeResponse -> Maybe Natural)
-> (ComputeResponse -> Maybe Natural -> ComputeResponse)
-> Lens
     ComputeResponse ComputeResponse (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeResponse' {Maybe Natural
simulationUnitLimit :: Maybe Natural
$sel:simulationUnitLimit:ComputeResponse' :: ComputeResponse -> Maybe Natural
simulationUnitLimit} -> Maybe Natural
simulationUnitLimit) (\s :: ComputeResponse
s@ComputeResponse' {} Maybe Natural
a -> ComputeResponse
s {$sel:simulationUnitLimit:ComputeResponse' :: Maybe Natural
simulationUnitLimit = Maybe Natural
a} :: ComputeResponse)

-- | Compute GPU unit limit for the simulation job. It is the same as the
-- number of GPUs allocated to the SimulationJob.
computeResponse_gpuUnitLimit :: Lens.Lens' ComputeResponse (Prelude.Maybe Prelude.Natural)
computeResponse_gpuUnitLimit :: (Maybe Natural -> f (Maybe Natural))
-> ComputeResponse -> f ComputeResponse
computeResponse_gpuUnitLimit = (ComputeResponse -> Maybe Natural)
-> (ComputeResponse -> Maybe Natural -> ComputeResponse)
-> Lens
     ComputeResponse ComputeResponse (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeResponse' {Maybe Natural
gpuUnitLimit :: Maybe Natural
$sel:gpuUnitLimit:ComputeResponse' :: ComputeResponse -> Maybe Natural
gpuUnitLimit} -> Maybe Natural
gpuUnitLimit) (\s :: ComputeResponse
s@ComputeResponse' {} Maybe Natural
a -> ComputeResponse
s {$sel:gpuUnitLimit:ComputeResponse' :: Maybe Natural
gpuUnitLimit = Maybe Natural
a} :: ComputeResponse)

-- | Compute type response information for the simulation job.
computeResponse_computeType :: Lens.Lens' ComputeResponse (Prelude.Maybe ComputeType)
computeResponse_computeType :: (Maybe ComputeType -> f (Maybe ComputeType))
-> ComputeResponse -> f ComputeResponse
computeResponse_computeType = (ComputeResponse -> Maybe ComputeType)
-> (ComputeResponse -> Maybe ComputeType -> ComputeResponse)
-> Lens
     ComputeResponse
     ComputeResponse
     (Maybe ComputeType)
     (Maybe ComputeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComputeResponse' {Maybe ComputeType
computeType :: Maybe ComputeType
$sel:computeType:ComputeResponse' :: ComputeResponse -> Maybe ComputeType
computeType} -> Maybe ComputeType
computeType) (\s :: ComputeResponse
s@ComputeResponse' {} Maybe ComputeType
a -> ComputeResponse
s {$sel:computeType:ComputeResponse' :: Maybe ComputeType
computeType = Maybe ComputeType
a} :: ComputeResponse)

instance Core.FromJSON ComputeResponse where
  parseJSON :: Value -> Parser ComputeResponse
parseJSON =
    String
-> (Object -> Parser ComputeResponse)
-> Value
-> Parser ComputeResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ComputeResponse"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural -> Maybe ComputeType -> ComputeResponse
ComputeResponse'
            (Maybe Natural
 -> Maybe Natural -> Maybe ComputeType -> ComputeResponse)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe ComputeType -> ComputeResponse)
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 -> ComputeResponse)
-> Parser (Maybe Natural)
-> Parser (Maybe ComputeType -> ComputeResponse)
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 -> ComputeResponse)
-> Parser (Maybe ComputeType) -> Parser ComputeResponse
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 ComputeResponse

instance Prelude.NFData ComputeResponse