{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElasticInference.Types.MemoryInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:sizeInMiB:MemoryInfo' :: Maybe Int
sizeInMiB = 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 :: Lens' MemoryInfo (Maybe Int)
memoryInfo_sizeInMiB = 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 Data.FromJSON MemoryInfo where
  parseJSON :: Value -> Parser MemoryInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MemoryInfo"
      ( \Object
x ->
          Maybe Int -> MemoryInfo
MemoryInfo' 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
"sizeInMiB")
      )

instance Prelude.Hashable MemoryInfo where
  hashWithSalt :: Int -> MemoryInfo -> Int
hashWithSalt Int
_salt MemoryInfo' {Maybe Int
sizeInMiB :: Maybe Int
$sel:sizeInMiB:MemoryInfo' :: MemoryInfo -> Maybe Int
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
sizeInMiB

instance Prelude.NFData MemoryInfo where
  rnf :: MemoryInfo -> ()
rnf MemoryInfo' {Maybe Int
sizeInMiB :: Maybe Int
$sel:sizeInMiB:MemoryInfo' :: MemoryInfo -> Maybe Int
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
sizeInMiB