{-# 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.GpuDeviceInfo
-- 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.GpuDeviceInfo 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 Amazonka.EC2.Types.GpuDeviceMemoryInfo
import qualified Amazonka.Prelude as Prelude

-- | Describes the GPU accelerators for the instance type.
--
-- /See:/ 'newGpuDeviceInfo' smart constructor.
data GpuDeviceInfo = GpuDeviceInfo'
  { -- | The number of GPUs for the instance type.
    GpuDeviceInfo -> Maybe Int
count :: Prelude.Maybe Prelude.Int,
    -- | The manufacturer of the GPU accelerator.
    GpuDeviceInfo -> Maybe Text
manufacturer :: Prelude.Maybe Prelude.Text,
    -- | Describes the memory available to the GPU accelerator.
    GpuDeviceInfo -> Maybe GpuDeviceMemoryInfo
memoryInfo :: Prelude.Maybe GpuDeviceMemoryInfo,
    -- | The name of the GPU accelerator.
    GpuDeviceInfo -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (GpuDeviceInfo -> GpuDeviceInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GpuDeviceInfo -> GpuDeviceInfo -> Bool
$c/= :: GpuDeviceInfo -> GpuDeviceInfo -> Bool
== :: GpuDeviceInfo -> GpuDeviceInfo -> Bool
$c== :: GpuDeviceInfo -> GpuDeviceInfo -> Bool
Prelude.Eq, ReadPrec [GpuDeviceInfo]
ReadPrec GpuDeviceInfo
Int -> ReadS GpuDeviceInfo
ReadS [GpuDeviceInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GpuDeviceInfo]
$creadListPrec :: ReadPrec [GpuDeviceInfo]
readPrec :: ReadPrec GpuDeviceInfo
$creadPrec :: ReadPrec GpuDeviceInfo
readList :: ReadS [GpuDeviceInfo]
$creadList :: ReadS [GpuDeviceInfo]
readsPrec :: Int -> ReadS GpuDeviceInfo
$creadsPrec :: Int -> ReadS GpuDeviceInfo
Prelude.Read, Int -> GpuDeviceInfo -> ShowS
[GpuDeviceInfo] -> ShowS
GpuDeviceInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GpuDeviceInfo] -> ShowS
$cshowList :: [GpuDeviceInfo] -> ShowS
show :: GpuDeviceInfo -> String
$cshow :: GpuDeviceInfo -> String
showsPrec :: Int -> GpuDeviceInfo -> ShowS
$cshowsPrec :: Int -> GpuDeviceInfo -> ShowS
Prelude.Show, forall x. Rep GpuDeviceInfo x -> GpuDeviceInfo
forall x. GpuDeviceInfo -> Rep GpuDeviceInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GpuDeviceInfo x -> GpuDeviceInfo
$cfrom :: forall x. GpuDeviceInfo -> Rep GpuDeviceInfo x
Prelude.Generic)

-- |
-- Create a value of 'GpuDeviceInfo' 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:
--
-- 'count', 'gpuDeviceInfo_count' - The number of GPUs for the instance type.
--
-- 'manufacturer', 'gpuDeviceInfo_manufacturer' - The manufacturer of the GPU accelerator.
--
-- 'memoryInfo', 'gpuDeviceInfo_memoryInfo' - Describes the memory available to the GPU accelerator.
--
-- 'name', 'gpuDeviceInfo_name' - The name of the GPU accelerator.
newGpuDeviceInfo ::
  GpuDeviceInfo
newGpuDeviceInfo :: GpuDeviceInfo
newGpuDeviceInfo =
  GpuDeviceInfo'
    { $sel:count:GpuDeviceInfo' :: Maybe Int
count = forall a. Maybe a
Prelude.Nothing,
      $sel:manufacturer:GpuDeviceInfo' :: Maybe Text
manufacturer = forall a. Maybe a
Prelude.Nothing,
      $sel:memoryInfo:GpuDeviceInfo' :: Maybe GpuDeviceMemoryInfo
memoryInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:name:GpuDeviceInfo' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of GPUs for the instance type.
gpuDeviceInfo_count :: Lens.Lens' GpuDeviceInfo (Prelude.Maybe Prelude.Int)
gpuDeviceInfo_count :: Lens' GpuDeviceInfo (Maybe Int)
gpuDeviceInfo_count = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GpuDeviceInfo' {Maybe Int
count :: Maybe Int
$sel:count:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe Int
count} -> Maybe Int
count) (\s :: GpuDeviceInfo
s@GpuDeviceInfo' {} Maybe Int
a -> GpuDeviceInfo
s {$sel:count:GpuDeviceInfo' :: Maybe Int
count = Maybe Int
a} :: GpuDeviceInfo)

-- | The manufacturer of the GPU accelerator.
gpuDeviceInfo_manufacturer :: Lens.Lens' GpuDeviceInfo (Prelude.Maybe Prelude.Text)
gpuDeviceInfo_manufacturer :: Lens' GpuDeviceInfo (Maybe Text)
gpuDeviceInfo_manufacturer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GpuDeviceInfo' {Maybe Text
manufacturer :: Maybe Text
$sel:manufacturer:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe Text
manufacturer} -> Maybe Text
manufacturer) (\s :: GpuDeviceInfo
s@GpuDeviceInfo' {} Maybe Text
a -> GpuDeviceInfo
s {$sel:manufacturer:GpuDeviceInfo' :: Maybe Text
manufacturer = Maybe Text
a} :: GpuDeviceInfo)

-- | Describes the memory available to the GPU accelerator.
gpuDeviceInfo_memoryInfo :: Lens.Lens' GpuDeviceInfo (Prelude.Maybe GpuDeviceMemoryInfo)
gpuDeviceInfo_memoryInfo :: Lens' GpuDeviceInfo (Maybe GpuDeviceMemoryInfo)
gpuDeviceInfo_memoryInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GpuDeviceInfo' {Maybe GpuDeviceMemoryInfo
memoryInfo :: Maybe GpuDeviceMemoryInfo
$sel:memoryInfo:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe GpuDeviceMemoryInfo
memoryInfo} -> Maybe GpuDeviceMemoryInfo
memoryInfo) (\s :: GpuDeviceInfo
s@GpuDeviceInfo' {} Maybe GpuDeviceMemoryInfo
a -> GpuDeviceInfo
s {$sel:memoryInfo:GpuDeviceInfo' :: Maybe GpuDeviceMemoryInfo
memoryInfo = Maybe GpuDeviceMemoryInfo
a} :: GpuDeviceInfo)

-- | The name of the GPU accelerator.
gpuDeviceInfo_name :: Lens.Lens' GpuDeviceInfo (Prelude.Maybe Prelude.Text)
gpuDeviceInfo_name :: Lens' GpuDeviceInfo (Maybe Text)
gpuDeviceInfo_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GpuDeviceInfo' {Maybe Text
name :: Maybe Text
$sel:name:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe Text
name} -> Maybe Text
name) (\s :: GpuDeviceInfo
s@GpuDeviceInfo' {} Maybe Text
a -> GpuDeviceInfo
s {$sel:name:GpuDeviceInfo' :: Maybe Text
name = Maybe Text
a} :: GpuDeviceInfo)

instance Data.FromXML GpuDeviceInfo where
  parseXML :: [Node] -> Either String GpuDeviceInfo
parseXML [Node]
x =
    Maybe Int
-> Maybe Text
-> Maybe GpuDeviceMemoryInfo
-> Maybe Text
-> GpuDeviceInfo
GpuDeviceInfo'
      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
"count")
      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
"manufacturer")
      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
"memoryInfo")
      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
"name")

instance Prelude.Hashable GpuDeviceInfo where
  hashWithSalt :: Int -> GpuDeviceInfo -> Int
hashWithSalt Int
_salt GpuDeviceInfo' {Maybe Int
Maybe Text
Maybe GpuDeviceMemoryInfo
name :: Maybe Text
memoryInfo :: Maybe GpuDeviceMemoryInfo
manufacturer :: Maybe Text
count :: Maybe Int
$sel:name:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe Text
$sel:memoryInfo:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe GpuDeviceMemoryInfo
$sel:manufacturer:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe Text
$sel:count:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
count
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
manufacturer
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GpuDeviceMemoryInfo
memoryInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData GpuDeviceInfo where
  rnf :: GpuDeviceInfo -> ()
rnf GpuDeviceInfo' {Maybe Int
Maybe Text
Maybe GpuDeviceMemoryInfo
name :: Maybe Text
memoryInfo :: Maybe GpuDeviceMemoryInfo
manufacturer :: Maybe Text
count :: Maybe Int
$sel:name:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe Text
$sel:memoryInfo:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe GpuDeviceMemoryInfo
$sel:manufacturer:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe Text
$sel:count:GpuDeviceInfo' :: GpuDeviceInfo -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
count
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
manufacturer
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GpuDeviceMemoryInfo
memoryInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name