{-# 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.AttachmentEnaSrdSpecification
-- 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.AttachmentEnaSrdSpecification 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.AttachmentEnaSrdUdpSpecification
import qualified Amazonka.Prelude as Prelude

-- | Describes the ENA Express configuration for the network interface
-- that\'s attached to the instance.
--
-- /See:/ 'newAttachmentEnaSrdSpecification' smart constructor.
data AttachmentEnaSrdSpecification = AttachmentEnaSrdSpecification'
  { -- | Indicates whether ENA Express is enabled for the network interface
    -- that\'s attached to the instance.
    AttachmentEnaSrdSpecification -> Maybe Bool
enaSrdEnabled :: Prelude.Maybe Prelude.Bool,
    -- | ENA Express configuration for UDP network traffic.
    AttachmentEnaSrdSpecification
-> Maybe AttachmentEnaSrdUdpSpecification
enaSrdUdpSpecification :: Prelude.Maybe AttachmentEnaSrdUdpSpecification
  }
  deriving (AttachmentEnaSrdSpecification
-> AttachmentEnaSrdSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachmentEnaSrdSpecification
-> AttachmentEnaSrdSpecification -> Bool
$c/= :: AttachmentEnaSrdSpecification
-> AttachmentEnaSrdSpecification -> Bool
== :: AttachmentEnaSrdSpecification
-> AttachmentEnaSrdSpecification -> Bool
$c== :: AttachmentEnaSrdSpecification
-> AttachmentEnaSrdSpecification -> Bool
Prelude.Eq, ReadPrec [AttachmentEnaSrdSpecification]
ReadPrec AttachmentEnaSrdSpecification
Int -> ReadS AttachmentEnaSrdSpecification
ReadS [AttachmentEnaSrdSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachmentEnaSrdSpecification]
$creadListPrec :: ReadPrec [AttachmentEnaSrdSpecification]
readPrec :: ReadPrec AttachmentEnaSrdSpecification
$creadPrec :: ReadPrec AttachmentEnaSrdSpecification
readList :: ReadS [AttachmentEnaSrdSpecification]
$creadList :: ReadS [AttachmentEnaSrdSpecification]
readsPrec :: Int -> ReadS AttachmentEnaSrdSpecification
$creadsPrec :: Int -> ReadS AttachmentEnaSrdSpecification
Prelude.Read, Int -> AttachmentEnaSrdSpecification -> ShowS
[AttachmentEnaSrdSpecification] -> ShowS
AttachmentEnaSrdSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachmentEnaSrdSpecification] -> ShowS
$cshowList :: [AttachmentEnaSrdSpecification] -> ShowS
show :: AttachmentEnaSrdSpecification -> String
$cshow :: AttachmentEnaSrdSpecification -> String
showsPrec :: Int -> AttachmentEnaSrdSpecification -> ShowS
$cshowsPrec :: Int -> AttachmentEnaSrdSpecification -> ShowS
Prelude.Show, forall x.
Rep AttachmentEnaSrdSpecification x
-> AttachmentEnaSrdSpecification
forall x.
AttachmentEnaSrdSpecification
-> Rep AttachmentEnaSrdSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AttachmentEnaSrdSpecification x
-> AttachmentEnaSrdSpecification
$cfrom :: forall x.
AttachmentEnaSrdSpecification
-> Rep AttachmentEnaSrdSpecification x
Prelude.Generic)

-- |
-- Create a value of 'AttachmentEnaSrdSpecification' 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:
--
-- 'enaSrdEnabled', 'attachmentEnaSrdSpecification_enaSrdEnabled' - Indicates whether ENA Express is enabled for the network interface
-- that\'s attached to the instance.
--
-- 'enaSrdUdpSpecification', 'attachmentEnaSrdSpecification_enaSrdUdpSpecification' - ENA Express configuration for UDP network traffic.
newAttachmentEnaSrdSpecification ::
  AttachmentEnaSrdSpecification
newAttachmentEnaSrdSpecification :: AttachmentEnaSrdSpecification
newAttachmentEnaSrdSpecification =
  AttachmentEnaSrdSpecification'
    { $sel:enaSrdEnabled:AttachmentEnaSrdSpecification' :: Maybe Bool
enaSrdEnabled =
        forall a. Maybe a
Prelude.Nothing,
      $sel:enaSrdUdpSpecification:AttachmentEnaSrdSpecification' :: Maybe AttachmentEnaSrdUdpSpecification
enaSrdUdpSpecification = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether ENA Express is enabled for the network interface
-- that\'s attached to the instance.
attachmentEnaSrdSpecification_enaSrdEnabled :: Lens.Lens' AttachmentEnaSrdSpecification (Prelude.Maybe Prelude.Bool)
attachmentEnaSrdSpecification_enaSrdEnabled :: Lens' AttachmentEnaSrdSpecification (Maybe Bool)
attachmentEnaSrdSpecification_enaSrdEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentEnaSrdSpecification' {Maybe Bool
enaSrdEnabled :: Maybe Bool
$sel:enaSrdEnabled:AttachmentEnaSrdSpecification' :: AttachmentEnaSrdSpecification -> Maybe Bool
enaSrdEnabled} -> Maybe Bool
enaSrdEnabled) (\s :: AttachmentEnaSrdSpecification
s@AttachmentEnaSrdSpecification' {} Maybe Bool
a -> AttachmentEnaSrdSpecification
s {$sel:enaSrdEnabled:AttachmentEnaSrdSpecification' :: Maybe Bool
enaSrdEnabled = Maybe Bool
a} :: AttachmentEnaSrdSpecification)

-- | ENA Express configuration for UDP network traffic.
attachmentEnaSrdSpecification_enaSrdUdpSpecification :: Lens.Lens' AttachmentEnaSrdSpecification (Prelude.Maybe AttachmentEnaSrdUdpSpecification)
attachmentEnaSrdSpecification_enaSrdUdpSpecification :: Lens'
  AttachmentEnaSrdSpecification
  (Maybe AttachmentEnaSrdUdpSpecification)
attachmentEnaSrdSpecification_enaSrdUdpSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentEnaSrdSpecification' {Maybe AttachmentEnaSrdUdpSpecification
enaSrdUdpSpecification :: Maybe AttachmentEnaSrdUdpSpecification
$sel:enaSrdUdpSpecification:AttachmentEnaSrdSpecification' :: AttachmentEnaSrdSpecification
-> Maybe AttachmentEnaSrdUdpSpecification
enaSrdUdpSpecification} -> Maybe AttachmentEnaSrdUdpSpecification
enaSrdUdpSpecification) (\s :: AttachmentEnaSrdSpecification
s@AttachmentEnaSrdSpecification' {} Maybe AttachmentEnaSrdUdpSpecification
a -> AttachmentEnaSrdSpecification
s {$sel:enaSrdUdpSpecification:AttachmentEnaSrdSpecification' :: Maybe AttachmentEnaSrdUdpSpecification
enaSrdUdpSpecification = Maybe AttachmentEnaSrdUdpSpecification
a} :: AttachmentEnaSrdSpecification)

instance Data.FromXML AttachmentEnaSrdSpecification where
  parseXML :: [Node] -> Either String AttachmentEnaSrdSpecification
parseXML [Node]
x =
    Maybe Bool
-> Maybe AttachmentEnaSrdUdpSpecification
-> AttachmentEnaSrdSpecification
AttachmentEnaSrdSpecification'
      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
"enaSrdEnabled")
      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
"enaSrdUdpSpecification")

instance
  Prelude.Hashable
    AttachmentEnaSrdSpecification
  where
  hashWithSalt :: Int -> AttachmentEnaSrdSpecification -> Int
hashWithSalt Int
_salt AttachmentEnaSrdSpecification' {Maybe Bool
Maybe AttachmentEnaSrdUdpSpecification
enaSrdUdpSpecification :: Maybe AttachmentEnaSrdUdpSpecification
enaSrdEnabled :: Maybe Bool
$sel:enaSrdUdpSpecification:AttachmentEnaSrdSpecification' :: AttachmentEnaSrdSpecification
-> Maybe AttachmentEnaSrdUdpSpecification
$sel:enaSrdEnabled:AttachmentEnaSrdSpecification' :: AttachmentEnaSrdSpecification -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enaSrdEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AttachmentEnaSrdUdpSpecification
enaSrdUdpSpecification

instance Prelude.NFData AttachmentEnaSrdSpecification where
  rnf :: AttachmentEnaSrdSpecification -> ()
rnf AttachmentEnaSrdSpecification' {Maybe Bool
Maybe AttachmentEnaSrdUdpSpecification
enaSrdUdpSpecification :: Maybe AttachmentEnaSrdUdpSpecification
enaSrdEnabled :: Maybe Bool
$sel:enaSrdUdpSpecification:AttachmentEnaSrdSpecification' :: AttachmentEnaSrdSpecification
-> Maybe AttachmentEnaSrdUdpSpecification
$sel:enaSrdEnabled:AttachmentEnaSrdSpecification' :: AttachmentEnaSrdSpecification -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enaSrdEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AttachmentEnaSrdUdpSpecification
enaSrdUdpSpecification