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

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

-- | The details of an Elastic Inference Accelerator type.
--
-- /See:/ 'newAcceleratorType' smart constructor.
data AcceleratorType = AcceleratorType'
  { -- | The throughput information of the Elastic Inference Accelerator type.
    AcceleratorType -> Maybe [KeyValuePair]
throughputInfo :: Prelude.Maybe [KeyValuePair],
    -- | The memory information of the Elastic Inference Accelerator type.
    AcceleratorType -> Maybe MemoryInfo
memoryInfo :: Prelude.Maybe MemoryInfo,
    -- | The name of the Elastic Inference Accelerator type.
    AcceleratorType -> Maybe Text
acceleratorTypeName :: Prelude.Maybe Prelude.Text
  }
  deriving (AcceleratorType -> AcceleratorType -> Bool
(AcceleratorType -> AcceleratorType -> Bool)
-> (AcceleratorType -> AcceleratorType -> Bool)
-> Eq AcceleratorType
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]
(Int -> ReadS AcceleratorType)
-> ReadS [AcceleratorType]
-> ReadPrec AcceleratorType
-> ReadPrec [AcceleratorType]
-> Read 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
(Int -> AcceleratorType -> ShowS)
-> (AcceleratorType -> String)
-> ([AcceleratorType] -> ShowS)
-> Show AcceleratorType
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. AcceleratorType -> Rep AcceleratorType x)
-> (forall x. Rep AcceleratorType x -> AcceleratorType)
-> Generic AcceleratorType
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:
--
-- 'throughputInfo', 'acceleratorType_throughputInfo' - The throughput information of the Elastic Inference Accelerator type.
--
-- 'memoryInfo', 'acceleratorType_memoryInfo' - The memory information of the Elastic Inference Accelerator type.
--
-- 'acceleratorTypeName', 'acceleratorType_acceleratorTypeName' - The name of the Elastic Inference Accelerator type.
newAcceleratorType ::
  AcceleratorType
newAcceleratorType :: AcceleratorType
newAcceleratorType =
  AcceleratorType' :: Maybe [KeyValuePair]
-> Maybe MemoryInfo -> Maybe Text -> AcceleratorType
AcceleratorType'
    { $sel:throughputInfo:AcceleratorType' :: Maybe [KeyValuePair]
throughputInfo = Maybe [KeyValuePair]
forall a. Maybe a
Prelude.Nothing,
      $sel:memoryInfo:AcceleratorType' :: Maybe MemoryInfo
memoryInfo = Maybe MemoryInfo
forall a. Maybe a
Prelude.Nothing,
      $sel:acceleratorTypeName:AcceleratorType' :: Maybe Text
acceleratorTypeName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The throughput information of the Elastic Inference Accelerator type.
acceleratorType_throughputInfo :: Lens.Lens' AcceleratorType (Prelude.Maybe [KeyValuePair])
acceleratorType_throughputInfo :: (Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> AcceleratorType -> f AcceleratorType
acceleratorType_throughputInfo = (AcceleratorType -> Maybe [KeyValuePair])
-> (AcceleratorType -> Maybe [KeyValuePair] -> AcceleratorType)
-> Lens
     AcceleratorType
     AcceleratorType
     (Maybe [KeyValuePair])
     (Maybe [KeyValuePair])
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) ((Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
 -> AcceleratorType -> f AcceleratorType)
-> ((Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
    -> Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> (Maybe [KeyValuePair] -> f (Maybe [KeyValuePair]))
-> AcceleratorType
-> f AcceleratorType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [KeyValuePair] [KeyValuePair] [KeyValuePair] [KeyValuePair]
-> Iso
     (Maybe [KeyValuePair])
     (Maybe [KeyValuePair])
     (Maybe [KeyValuePair])
     (Maybe [KeyValuePair])
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 AnIso [KeyValuePair] [KeyValuePair] [KeyValuePair] [KeyValuePair]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The memory information of the Elastic Inference Accelerator type.
acceleratorType_memoryInfo :: Lens.Lens' AcceleratorType (Prelude.Maybe MemoryInfo)
acceleratorType_memoryInfo :: (Maybe MemoryInfo -> f (Maybe MemoryInfo))
-> AcceleratorType -> f AcceleratorType
acceleratorType_memoryInfo = (AcceleratorType -> Maybe MemoryInfo)
-> (AcceleratorType -> Maybe MemoryInfo -> AcceleratorType)
-> Lens
     AcceleratorType
     AcceleratorType
     (Maybe MemoryInfo)
     (Maybe 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 name of the Elastic Inference Accelerator type.
acceleratorType_acceleratorTypeName :: Lens.Lens' AcceleratorType (Prelude.Maybe Prelude.Text)
acceleratorType_acceleratorTypeName :: (Maybe Text -> f (Maybe Text))
-> AcceleratorType -> f AcceleratorType
acceleratorType_acceleratorTypeName = (AcceleratorType -> Maybe Text)
-> (AcceleratorType -> Maybe Text -> AcceleratorType)
-> Lens AcceleratorType AcceleratorType (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable AcceleratorType

instance Prelude.NFData AcceleratorType