{-# 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.AcceleratorType
-- 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.AcceleratorType where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticInference.Types.KeyValuePair
import Amazonka.ElasticInference.Types.MemoryInfo
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'AcceleratorType' 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:
--
-- 'acceleratorTypeName', 'acceleratorType_acceleratorTypeName' - The name of the Elastic Inference Accelerator type.
--
-- 'memoryInfo', 'acceleratorType_memoryInfo' - The memory information of the Elastic Inference Accelerator type.
--
-- 'throughputInfo', 'acceleratorType_throughputInfo' - The throughput information of the Elastic Inference Accelerator type.
newAcceleratorType ::
  AcceleratorType
newAcceleratorType :: AcceleratorType
newAcceleratorType =
  AcceleratorType'
    { $sel:acceleratorTypeName:AcceleratorType' :: Maybe Text
acceleratorTypeName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:memoryInfo:AcceleratorType' :: Maybe MemoryInfo
memoryInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:throughputInfo:AcceleratorType' :: Maybe [KeyValuePair]
throughputInfo = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the Elastic Inference Accelerator type.
acceleratorType_acceleratorTypeName :: Lens.Lens' AcceleratorType (Prelude.Maybe Prelude.Text)
acceleratorType_acceleratorTypeName :: Lens' AcceleratorType (Maybe Text)
acceleratorType_acceleratorTypeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceleratorType' {Maybe Text
acceleratorTypeName :: Maybe Text
$sel:acceleratorTypeName:AcceleratorType' :: AcceleratorType -> Maybe Text
acceleratorTypeName} -> Maybe Text
acceleratorTypeName) (\s :: AcceleratorType
s@AcceleratorType' {} Maybe Text
a -> AcceleratorType
s {$sel:acceleratorTypeName:AcceleratorType' :: Maybe Text
acceleratorTypeName = Maybe Text
a} :: AcceleratorType)

-- | The memory information of the Elastic Inference Accelerator type.
acceleratorType_memoryInfo :: Lens.Lens' AcceleratorType (Prelude.Maybe MemoryInfo)
acceleratorType_memoryInfo :: Lens' AcceleratorType (Maybe MemoryInfo)
acceleratorType_memoryInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceleratorType' {Maybe MemoryInfo
memoryInfo :: Maybe MemoryInfo
$sel:memoryInfo:AcceleratorType' :: AcceleratorType -> Maybe MemoryInfo
memoryInfo} -> Maybe MemoryInfo
memoryInfo) (\s :: AcceleratorType
s@AcceleratorType' {} Maybe MemoryInfo
a -> AcceleratorType
s {$sel:memoryInfo:AcceleratorType' :: Maybe MemoryInfo
memoryInfo = Maybe MemoryInfo
a} :: AcceleratorType)

-- | The throughput information of the Elastic Inference Accelerator type.
acceleratorType_throughputInfo :: Lens.Lens' AcceleratorType (Prelude.Maybe [KeyValuePair])
acceleratorType_throughputInfo :: Lens' AcceleratorType (Maybe [KeyValuePair])
acceleratorType_throughputInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceleratorType' {Maybe [KeyValuePair]
throughputInfo :: Maybe [KeyValuePair]
$sel:throughputInfo:AcceleratorType' :: AcceleratorType -> Maybe [KeyValuePair]
throughputInfo} -> Maybe [KeyValuePair]
throughputInfo) (\s :: AcceleratorType
s@AcceleratorType' {} Maybe [KeyValuePair]
a -> AcceleratorType
s {$sel:throughputInfo:AcceleratorType' :: Maybe [KeyValuePair]
throughputInfo = Maybe [KeyValuePair]
a} :: AcceleratorType) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON AcceleratorType where
  parseJSON :: Value -> Parser AcceleratorType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AcceleratorType"
      ( \Object
x ->
          Maybe Text
-> Maybe MemoryInfo -> Maybe [KeyValuePair] -> AcceleratorType
AcceleratorType'
            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
"acceleratorTypeName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"memoryInfo")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"throughputInfo"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable AcceleratorType where
  hashWithSalt :: Int -> AcceleratorType -> Int
hashWithSalt Int
_salt AcceleratorType' {Maybe [KeyValuePair]
Maybe Text
Maybe MemoryInfo
throughputInfo :: Maybe [KeyValuePair]
memoryInfo :: Maybe MemoryInfo
acceleratorTypeName :: Maybe Text
$sel:throughputInfo:AcceleratorType' :: AcceleratorType -> Maybe [KeyValuePair]
$sel:memoryInfo:AcceleratorType' :: AcceleratorType -> Maybe MemoryInfo
$sel:acceleratorTypeName:AcceleratorType' :: AcceleratorType -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
acceleratorTypeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MemoryInfo
memoryInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [KeyValuePair]
throughputInfo

instance Prelude.NFData AcceleratorType where
  rnf :: AcceleratorType -> ()
rnf AcceleratorType' {Maybe [KeyValuePair]
Maybe Text
Maybe MemoryInfo
throughputInfo :: Maybe [KeyValuePair]
memoryInfo :: Maybe MemoryInfo
acceleratorTypeName :: Maybe Text
$sel:throughputInfo:AcceleratorType' :: AcceleratorType -> Maybe [KeyValuePair]
$sel:memoryInfo:AcceleratorType' :: AcceleratorType -> Maybe MemoryInfo
$sel:acceleratorTypeName:AcceleratorType' :: AcceleratorType -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
acceleratorTypeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MemoryInfo
memoryInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [KeyValuePair]
throughputInfo