{-# 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.ElasticInference.Types.MemoryInfo
-- 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.ElasticInference.Types.MemoryInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The memory information of an Elastic Inference Accelerator type.
--
-- /See:/ 'newMemoryInfo' smart constructor.
data MemoryInfo = MemoryInfo'
  { -- | The size in mebibytes of the Elastic Inference Accelerator type.
    MemoryInfo -> Maybe Int
sizeInMiB :: Prelude.Maybe Prelude.Int
  }
  deriving (MemoryInfo -> MemoryInfo -> Bool
(MemoryInfo -> MemoryInfo -> Bool)
-> (MemoryInfo -> MemoryInfo -> Bool) -> Eq MemoryInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemoryInfo -> MemoryInfo -> Bool
$c/= :: MemoryInfo -> MemoryInfo -> Bool
== :: MemoryInfo -> MemoryInfo -> Bool
$c== :: MemoryInfo -> MemoryInfo -> Bool
Prelude.Eq, ReadPrec [MemoryInfo]
ReadPrec MemoryInfo
Int -> ReadS MemoryInfo
ReadS [MemoryInfo]
(Int -> ReadS MemoryInfo)
-> ReadS [MemoryInfo]
-> ReadPrec MemoryInfo
-> ReadPrec [MemoryInfo]
-> Read MemoryInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MemoryInfo]
$creadListPrec :: ReadPrec [MemoryInfo]
readPrec :: ReadPrec MemoryInfo
$creadPrec :: ReadPrec MemoryInfo
readList :: ReadS [MemoryInfo]
$creadList :: ReadS [MemoryInfo]
readsPrec :: Int -> ReadS MemoryInfo
$creadsPrec :: Int -> ReadS MemoryInfo
Prelude.Read, Int -> MemoryInfo -> ShowS
[MemoryInfo] -> ShowS
MemoryInfo -> String
(Int -> MemoryInfo -> ShowS)
-> (MemoryInfo -> String)
-> ([MemoryInfo] -> ShowS)
-> Show MemoryInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MemoryInfo] -> ShowS
$cshowList :: [MemoryInfo] -> ShowS
show :: MemoryInfo -> String
$cshow :: MemoryInfo -> String
showsPrec :: Int -> MemoryInfo -> ShowS
$cshowsPrec :: Int -> MemoryInfo -> ShowS
Prelude.Show, (forall x. MemoryInfo -> Rep MemoryInfo x)
-> (forall x. Rep MemoryInfo x -> MemoryInfo) -> Generic MemoryInfo
forall x. Rep MemoryInfo x -> MemoryInfo
forall x. MemoryInfo -> Rep MemoryInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MemoryInfo x -> MemoryInfo
$cfrom :: forall x. MemoryInfo -> Rep MemoryInfo x
Prelude.Generic)

-- |
-- Create a value of 'MemoryInfo' 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:
--
-- 'sizeInMiB', 'memoryInfo_sizeInMiB' - The size in mebibytes of the Elastic Inference Accelerator type.
newMemoryInfo ::
  MemoryInfo
newMemoryInfo :: MemoryInfo
newMemoryInfo =
  MemoryInfo' :: Maybe Int -> MemoryInfo
MemoryInfo' {$sel:sizeInMiB:MemoryInfo' :: Maybe Int
sizeInMiB = Maybe Int
forall a. Maybe a
Prelude.Nothing}

-- | The size in mebibytes of the Elastic Inference Accelerator type.
memoryInfo_sizeInMiB :: Lens.Lens' MemoryInfo (Prelude.Maybe Prelude.Int)
memoryInfo_sizeInMiB :: (Maybe Int -> f (Maybe Int)) -> MemoryInfo -> f MemoryInfo
memoryInfo_sizeInMiB = (MemoryInfo -> Maybe Int)
-> (MemoryInfo -> Maybe Int -> MemoryInfo)
-> Lens MemoryInfo MemoryInfo (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemoryInfo' {Maybe Int
sizeInMiB :: Maybe Int
$sel:sizeInMiB:MemoryInfo' :: MemoryInfo -> Maybe Int
sizeInMiB} -> Maybe Int
sizeInMiB) (\s :: MemoryInfo
s@MemoryInfo' {} Maybe Int
a -> MemoryInfo
s {$sel:sizeInMiB:MemoryInfo' :: Maybe Int
sizeInMiB = Maybe Int
a} :: MemoryInfo)

instance Core.FromJSON MemoryInfo where
  parseJSON :: Value -> Parser MemoryInfo
parseJSON =
    String
-> (Object -> Parser MemoryInfo) -> Value -> Parser MemoryInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MemoryInfo"
      ( \Object
x ->
          Maybe Int -> MemoryInfo
MemoryInfo' (Maybe Int -> MemoryInfo)
-> Parser (Maybe Int) -> Parser MemoryInfo
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sizeInMiB")
      )

instance Prelude.Hashable MemoryInfo

instance Prelude.NFData MemoryInfo