{-# 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.NetworkCardInfo
-- 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.NetworkCardInfo 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 network card support of the instance type.
--
-- /See:/ 'newNetworkCardInfo' smart constructor.
data NetworkCardInfo = NetworkCardInfo'
  { -- | The maximum number of network interfaces for the network card.
    NetworkCardInfo -> Maybe Int
maximumNetworkInterfaces :: Prelude.Maybe Prelude.Int,
    -- | The index of the network card.
    NetworkCardInfo -> Maybe Int
networkCardIndex :: Prelude.Maybe Prelude.Int,
    -- | The network performance of the network card.
    NetworkCardInfo -> Maybe Text
networkPerformance :: Prelude.Maybe Prelude.Text
  }
  deriving (NetworkCardInfo -> NetworkCardInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkCardInfo -> NetworkCardInfo -> Bool
$c/= :: NetworkCardInfo -> NetworkCardInfo -> Bool
== :: NetworkCardInfo -> NetworkCardInfo -> Bool
$c== :: NetworkCardInfo -> NetworkCardInfo -> Bool
Prelude.Eq, ReadPrec [NetworkCardInfo]
ReadPrec NetworkCardInfo
Int -> ReadS NetworkCardInfo
ReadS [NetworkCardInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkCardInfo]
$creadListPrec :: ReadPrec [NetworkCardInfo]
readPrec :: ReadPrec NetworkCardInfo
$creadPrec :: ReadPrec NetworkCardInfo
readList :: ReadS [NetworkCardInfo]
$creadList :: ReadS [NetworkCardInfo]
readsPrec :: Int -> ReadS NetworkCardInfo
$creadsPrec :: Int -> ReadS NetworkCardInfo
Prelude.Read, Int -> NetworkCardInfo -> ShowS
[NetworkCardInfo] -> ShowS
NetworkCardInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkCardInfo] -> ShowS
$cshowList :: [NetworkCardInfo] -> ShowS
show :: NetworkCardInfo -> String
$cshow :: NetworkCardInfo -> String
showsPrec :: Int -> NetworkCardInfo -> ShowS
$cshowsPrec :: Int -> NetworkCardInfo -> ShowS
Prelude.Show, forall x. Rep NetworkCardInfo x -> NetworkCardInfo
forall x. NetworkCardInfo -> Rep NetworkCardInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkCardInfo x -> NetworkCardInfo
$cfrom :: forall x. NetworkCardInfo -> Rep NetworkCardInfo x
Prelude.Generic)

-- |
-- Create a value of 'NetworkCardInfo' 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:
--
-- 'maximumNetworkInterfaces', 'networkCardInfo_maximumNetworkInterfaces' - The maximum number of network interfaces for the network card.
--
-- 'networkCardIndex', 'networkCardInfo_networkCardIndex' - The index of the network card.
--
-- 'networkPerformance', 'networkCardInfo_networkPerformance' - The network performance of the network card.
newNetworkCardInfo ::
  NetworkCardInfo
newNetworkCardInfo :: NetworkCardInfo
newNetworkCardInfo =
  NetworkCardInfo'
    { $sel:maximumNetworkInterfaces:NetworkCardInfo' :: Maybe Int
maximumNetworkInterfaces =
        forall a. Maybe a
Prelude.Nothing,
      $sel:networkCardIndex:NetworkCardInfo' :: Maybe Int
networkCardIndex = forall a. Maybe a
Prelude.Nothing,
      $sel:networkPerformance:NetworkCardInfo' :: Maybe Text
networkPerformance = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of network interfaces for the network card.
networkCardInfo_maximumNetworkInterfaces :: Lens.Lens' NetworkCardInfo (Prelude.Maybe Prelude.Int)
networkCardInfo_maximumNetworkInterfaces :: Lens' NetworkCardInfo (Maybe Int)
networkCardInfo_maximumNetworkInterfaces = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkCardInfo' {Maybe Int
maximumNetworkInterfaces :: Maybe Int
$sel:maximumNetworkInterfaces:NetworkCardInfo' :: NetworkCardInfo -> Maybe Int
maximumNetworkInterfaces} -> Maybe Int
maximumNetworkInterfaces) (\s :: NetworkCardInfo
s@NetworkCardInfo' {} Maybe Int
a -> NetworkCardInfo
s {$sel:maximumNetworkInterfaces:NetworkCardInfo' :: Maybe Int
maximumNetworkInterfaces = Maybe Int
a} :: NetworkCardInfo)

-- | The index of the network card.
networkCardInfo_networkCardIndex :: Lens.Lens' NetworkCardInfo (Prelude.Maybe Prelude.Int)
networkCardInfo_networkCardIndex :: Lens' NetworkCardInfo (Maybe Int)
networkCardInfo_networkCardIndex = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkCardInfo' {Maybe Int
networkCardIndex :: Maybe Int
$sel:networkCardIndex:NetworkCardInfo' :: NetworkCardInfo -> Maybe Int
networkCardIndex} -> Maybe Int
networkCardIndex) (\s :: NetworkCardInfo
s@NetworkCardInfo' {} Maybe Int
a -> NetworkCardInfo
s {$sel:networkCardIndex:NetworkCardInfo' :: Maybe Int
networkCardIndex = Maybe Int
a} :: NetworkCardInfo)

-- | The network performance of the network card.
networkCardInfo_networkPerformance :: Lens.Lens' NetworkCardInfo (Prelude.Maybe Prelude.Text)
networkCardInfo_networkPerformance :: Lens' NetworkCardInfo (Maybe Text)
networkCardInfo_networkPerformance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkCardInfo' {Maybe Text
networkPerformance :: Maybe Text
$sel:networkPerformance:NetworkCardInfo' :: NetworkCardInfo -> Maybe Text
networkPerformance} -> Maybe Text
networkPerformance) (\s :: NetworkCardInfo
s@NetworkCardInfo' {} Maybe Text
a -> NetworkCardInfo
s {$sel:networkPerformance:NetworkCardInfo' :: Maybe Text
networkPerformance = Maybe Text
a} :: NetworkCardInfo)

instance Data.FromXML NetworkCardInfo where
  parseXML :: [Node] -> Either String NetworkCardInfo
parseXML [Node]
x =
    Maybe Int -> Maybe Int -> Maybe Text -> NetworkCardInfo
NetworkCardInfo'
      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
"maximumNetworkInterfaces")
      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
"networkCardIndex")
      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
"networkPerformance")

instance Prelude.Hashable NetworkCardInfo where
  hashWithSalt :: Int -> NetworkCardInfo -> Int
hashWithSalt Int
_salt NetworkCardInfo' {Maybe Int
Maybe Text
networkPerformance :: Maybe Text
networkCardIndex :: Maybe Int
maximumNetworkInterfaces :: Maybe Int
$sel:networkPerformance:NetworkCardInfo' :: NetworkCardInfo -> Maybe Text
$sel:networkCardIndex:NetworkCardInfo' :: NetworkCardInfo -> Maybe Int
$sel:maximumNetworkInterfaces:NetworkCardInfo' :: NetworkCardInfo -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maximumNetworkInterfaces
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
networkCardIndex
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
networkPerformance

instance Prelude.NFData NetworkCardInfo where
  rnf :: NetworkCardInfo -> ()
rnf NetworkCardInfo' {Maybe Int
Maybe Text
networkPerformance :: Maybe Text
networkCardIndex :: Maybe Int
maximumNetworkInterfaces :: Maybe Int
$sel:networkPerformance:NetworkCardInfo' :: NetworkCardInfo -> Maybe Text
$sel:networkCardIndex:NetworkCardInfo' :: NetworkCardInfo -> Maybe Int
$sel:maximumNetworkInterfaces:NetworkCardInfo' :: NetworkCardInfo -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maximumNetworkInterfaces
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
networkCardIndex
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
networkPerformance