{-# 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.AcceleratorTotalMemoryMiB
-- 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.AcceleratorTotalMemoryMiB 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

-- | The minimum and maximum amount of total accelerator memory, in MiB.
--
-- /See:/ 'newAcceleratorTotalMemoryMiB' smart constructor.
data AcceleratorTotalMemoryMiB = AcceleratorTotalMemoryMiB'
  { -- | The maximum amount of accelerator memory, in MiB. If this parameter is
    -- not specified, there is no maximum limit.
    AcceleratorTotalMemoryMiB -> Maybe Int
max :: Prelude.Maybe Prelude.Int,
    -- | The minimum amount of accelerator memory, in MiB. If this parameter is
    -- not specified, there is no minimum limit.
    AcceleratorTotalMemoryMiB -> Maybe Int
min :: Prelude.Maybe Prelude.Int
  }
  deriving (AcceleratorTotalMemoryMiB -> AcceleratorTotalMemoryMiB -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceleratorTotalMemoryMiB -> AcceleratorTotalMemoryMiB -> Bool
$c/= :: AcceleratorTotalMemoryMiB -> AcceleratorTotalMemoryMiB -> Bool
== :: AcceleratorTotalMemoryMiB -> AcceleratorTotalMemoryMiB -> Bool
$c== :: AcceleratorTotalMemoryMiB -> AcceleratorTotalMemoryMiB -> Bool
Prelude.Eq, ReadPrec [AcceleratorTotalMemoryMiB]
ReadPrec AcceleratorTotalMemoryMiB
Int -> ReadS AcceleratorTotalMemoryMiB
ReadS [AcceleratorTotalMemoryMiB]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceleratorTotalMemoryMiB]
$creadListPrec :: ReadPrec [AcceleratorTotalMemoryMiB]
readPrec :: ReadPrec AcceleratorTotalMemoryMiB
$creadPrec :: ReadPrec AcceleratorTotalMemoryMiB
readList :: ReadS [AcceleratorTotalMemoryMiB]
$creadList :: ReadS [AcceleratorTotalMemoryMiB]
readsPrec :: Int -> ReadS AcceleratorTotalMemoryMiB
$creadsPrec :: Int -> ReadS AcceleratorTotalMemoryMiB
Prelude.Read, Int -> AcceleratorTotalMemoryMiB -> ShowS
[AcceleratorTotalMemoryMiB] -> ShowS
AcceleratorTotalMemoryMiB -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceleratorTotalMemoryMiB] -> ShowS
$cshowList :: [AcceleratorTotalMemoryMiB] -> ShowS
show :: AcceleratorTotalMemoryMiB -> String
$cshow :: AcceleratorTotalMemoryMiB -> String
showsPrec :: Int -> AcceleratorTotalMemoryMiB -> ShowS
$cshowsPrec :: Int -> AcceleratorTotalMemoryMiB -> ShowS
Prelude.Show, forall x.
Rep AcceleratorTotalMemoryMiB x -> AcceleratorTotalMemoryMiB
forall x.
AcceleratorTotalMemoryMiB -> Rep AcceleratorTotalMemoryMiB x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AcceleratorTotalMemoryMiB x -> AcceleratorTotalMemoryMiB
$cfrom :: forall x.
AcceleratorTotalMemoryMiB -> Rep AcceleratorTotalMemoryMiB x
Prelude.Generic)

-- |
-- Create a value of 'AcceleratorTotalMemoryMiB' 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:
--
-- 'max', 'acceleratorTotalMemoryMiB_max' - The maximum amount of accelerator memory, in MiB. If this parameter is
-- not specified, there is no maximum limit.
--
-- 'min', 'acceleratorTotalMemoryMiB_min' - The minimum amount of accelerator memory, in MiB. If this parameter is
-- not specified, there is no minimum limit.
newAcceleratorTotalMemoryMiB ::
  AcceleratorTotalMemoryMiB
newAcceleratorTotalMemoryMiB :: AcceleratorTotalMemoryMiB
newAcceleratorTotalMemoryMiB =
  AcceleratorTotalMemoryMiB'
    { $sel:max:AcceleratorTotalMemoryMiB' :: Maybe Int
max = forall a. Maybe a
Prelude.Nothing,
      $sel:min:AcceleratorTotalMemoryMiB' :: Maybe Int
min = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum amount of accelerator memory, in MiB. If this parameter is
-- not specified, there is no maximum limit.
acceleratorTotalMemoryMiB_max :: Lens.Lens' AcceleratorTotalMemoryMiB (Prelude.Maybe Prelude.Int)
acceleratorTotalMemoryMiB_max :: Lens' AcceleratorTotalMemoryMiB (Maybe Int)
acceleratorTotalMemoryMiB_max = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceleratorTotalMemoryMiB' {Maybe Int
max :: Maybe Int
$sel:max:AcceleratorTotalMemoryMiB' :: AcceleratorTotalMemoryMiB -> Maybe Int
max} -> Maybe Int
max) (\s :: AcceleratorTotalMemoryMiB
s@AcceleratorTotalMemoryMiB' {} Maybe Int
a -> AcceleratorTotalMemoryMiB
s {$sel:max:AcceleratorTotalMemoryMiB' :: Maybe Int
max = Maybe Int
a} :: AcceleratorTotalMemoryMiB)

-- | The minimum amount of accelerator memory, in MiB. If this parameter is
-- not specified, there is no minimum limit.
acceleratorTotalMemoryMiB_min :: Lens.Lens' AcceleratorTotalMemoryMiB (Prelude.Maybe Prelude.Int)
acceleratorTotalMemoryMiB_min :: Lens' AcceleratorTotalMemoryMiB (Maybe Int)
acceleratorTotalMemoryMiB_min = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceleratorTotalMemoryMiB' {Maybe Int
min :: Maybe Int
$sel:min:AcceleratorTotalMemoryMiB' :: AcceleratorTotalMemoryMiB -> Maybe Int
min} -> Maybe Int
min) (\s :: AcceleratorTotalMemoryMiB
s@AcceleratorTotalMemoryMiB' {} Maybe Int
a -> AcceleratorTotalMemoryMiB
s {$sel:min:AcceleratorTotalMemoryMiB' :: Maybe Int
min = Maybe Int
a} :: AcceleratorTotalMemoryMiB)

instance Data.FromXML AcceleratorTotalMemoryMiB where
  parseXML :: [Node] -> Either String AcceleratorTotalMemoryMiB
parseXML [Node]
x =
    Maybe Int -> Maybe Int -> AcceleratorTotalMemoryMiB
AcceleratorTotalMemoryMiB'
      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
"max")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"min")

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

instance Prelude.NFData AcceleratorTotalMemoryMiB where
  rnf :: AcceleratorTotalMemoryMiB -> ()
rnf AcceleratorTotalMemoryMiB' {Maybe Int
min :: Maybe Int
max :: Maybe Int
$sel:min:AcceleratorTotalMemoryMiB' :: AcceleratorTotalMemoryMiB -> Maybe Int
$sel:max:AcceleratorTotalMemoryMiB' :: AcceleratorTotalMemoryMiB -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
max seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
min

instance Data.ToQuery AcceleratorTotalMemoryMiB where
  toQuery :: AcceleratorTotalMemoryMiB -> QueryString
toQuery AcceleratorTotalMemoryMiB' {Maybe Int
min :: Maybe Int
max :: Maybe Int
$sel:min:AcceleratorTotalMemoryMiB' :: AcceleratorTotalMemoryMiB -> Maybe Int
$sel:max:AcceleratorTotalMemoryMiB' :: AcceleratorTotalMemoryMiB -> Maybe Int
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"Max" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
max, ByteString
"Min" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
min]