{-# 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.EC2.Types.FpgaDeviceMemoryInfo
-- 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.EC2.Types.FpgaDeviceMemoryInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | Describes the memory for the FPGA accelerator for the instance type.
--
-- /See:/ 'newFpgaDeviceMemoryInfo' smart constructor.
data FpgaDeviceMemoryInfo = FpgaDeviceMemoryInfo'
  { -- | The size of the memory available to the FPGA accelerator, in MiB.
    FpgaDeviceMemoryInfo -> Maybe Int
sizeInMiB :: Prelude.Maybe Prelude.Int
  }
  deriving (FpgaDeviceMemoryInfo -> FpgaDeviceMemoryInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FpgaDeviceMemoryInfo -> FpgaDeviceMemoryInfo -> Bool
$c/= :: FpgaDeviceMemoryInfo -> FpgaDeviceMemoryInfo -> Bool
== :: FpgaDeviceMemoryInfo -> FpgaDeviceMemoryInfo -> Bool
$c== :: FpgaDeviceMemoryInfo -> FpgaDeviceMemoryInfo -> Bool
Prelude.Eq, ReadPrec [FpgaDeviceMemoryInfo]
ReadPrec FpgaDeviceMemoryInfo
Int -> ReadS FpgaDeviceMemoryInfo
ReadS [FpgaDeviceMemoryInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FpgaDeviceMemoryInfo]
$creadListPrec :: ReadPrec [FpgaDeviceMemoryInfo]
readPrec :: ReadPrec FpgaDeviceMemoryInfo
$creadPrec :: ReadPrec FpgaDeviceMemoryInfo
readList :: ReadS [FpgaDeviceMemoryInfo]
$creadList :: ReadS [FpgaDeviceMemoryInfo]
readsPrec :: Int -> ReadS FpgaDeviceMemoryInfo
$creadsPrec :: Int -> ReadS FpgaDeviceMemoryInfo
Prelude.Read, Int -> FpgaDeviceMemoryInfo -> ShowS
[FpgaDeviceMemoryInfo] -> ShowS
FpgaDeviceMemoryInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FpgaDeviceMemoryInfo] -> ShowS
$cshowList :: [FpgaDeviceMemoryInfo] -> ShowS
show :: FpgaDeviceMemoryInfo -> String
$cshow :: FpgaDeviceMemoryInfo -> String
showsPrec :: Int -> FpgaDeviceMemoryInfo -> ShowS
$cshowsPrec :: Int -> FpgaDeviceMemoryInfo -> ShowS
Prelude.Show, forall x. Rep FpgaDeviceMemoryInfo x -> FpgaDeviceMemoryInfo
forall x. FpgaDeviceMemoryInfo -> Rep FpgaDeviceMemoryInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FpgaDeviceMemoryInfo x -> FpgaDeviceMemoryInfo
$cfrom :: forall x. FpgaDeviceMemoryInfo -> Rep FpgaDeviceMemoryInfo x
Prelude.Generic)

-- |
-- Create a value of 'FpgaDeviceMemoryInfo' 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', 'fpgaDeviceMemoryInfo_sizeInMiB' - The size of the memory available to the FPGA accelerator, in MiB.
newFpgaDeviceMemoryInfo ::
  FpgaDeviceMemoryInfo
newFpgaDeviceMemoryInfo :: FpgaDeviceMemoryInfo
newFpgaDeviceMemoryInfo =
  FpgaDeviceMemoryInfo' {$sel:sizeInMiB:FpgaDeviceMemoryInfo' :: Maybe Int
sizeInMiB = forall a. Maybe a
Prelude.Nothing}

-- | The size of the memory available to the FPGA accelerator, in MiB.
fpgaDeviceMemoryInfo_sizeInMiB :: Lens.Lens' FpgaDeviceMemoryInfo (Prelude.Maybe Prelude.Int)
fpgaDeviceMemoryInfo_sizeInMiB :: Lens' FpgaDeviceMemoryInfo (Maybe Int)
fpgaDeviceMemoryInfo_sizeInMiB = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FpgaDeviceMemoryInfo' {Maybe Int
sizeInMiB :: Maybe Int
$sel:sizeInMiB:FpgaDeviceMemoryInfo' :: FpgaDeviceMemoryInfo -> Maybe Int
sizeInMiB} -> Maybe Int
sizeInMiB) (\s :: FpgaDeviceMemoryInfo
s@FpgaDeviceMemoryInfo' {} Maybe Int
a -> FpgaDeviceMemoryInfo
s {$sel:sizeInMiB:FpgaDeviceMemoryInfo' :: Maybe Int
sizeInMiB = Maybe Int
a} :: FpgaDeviceMemoryInfo)

instance Data.FromXML FpgaDeviceMemoryInfo where
  parseXML :: [Node] -> Either String FpgaDeviceMemoryInfo
parseXML [Node]
x =
    Maybe Int -> FpgaDeviceMemoryInfo
FpgaDeviceMemoryInfo'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"sizeInMiB")

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

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