{-# 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.SecurityHub.Types.AwsEc2InstanceNetworkInterfacesDetails
-- 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.SecurityHub.Types.AwsEc2InstanceNetworkInterfacesDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Identifies a network interface for the EC2 instance.
--
-- /See:/ 'newAwsEc2InstanceNetworkInterfacesDetails' smart constructor.
data AwsEc2InstanceNetworkInterfacesDetails = AwsEc2InstanceNetworkInterfacesDetails'
  { -- | The identifier of the network interface. The details are in a
    -- corresponding @AwsEc2NetworkInterfacesDetails@ object.
    AwsEc2InstanceNetworkInterfacesDetails -> Maybe Text
networkInterfaceId :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsEc2InstanceNetworkInterfacesDetails
-> AwsEc2InstanceNetworkInterfacesDetails -> Bool
(AwsEc2InstanceNetworkInterfacesDetails
 -> AwsEc2InstanceNetworkInterfacesDetails -> Bool)
-> (AwsEc2InstanceNetworkInterfacesDetails
    -> AwsEc2InstanceNetworkInterfacesDetails -> Bool)
-> Eq AwsEc2InstanceNetworkInterfacesDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEc2InstanceNetworkInterfacesDetails
-> AwsEc2InstanceNetworkInterfacesDetails -> Bool
$c/= :: AwsEc2InstanceNetworkInterfacesDetails
-> AwsEc2InstanceNetworkInterfacesDetails -> Bool
== :: AwsEc2InstanceNetworkInterfacesDetails
-> AwsEc2InstanceNetworkInterfacesDetails -> Bool
$c== :: AwsEc2InstanceNetworkInterfacesDetails
-> AwsEc2InstanceNetworkInterfacesDetails -> Bool
Prelude.Eq, ReadPrec [AwsEc2InstanceNetworkInterfacesDetails]
ReadPrec AwsEc2InstanceNetworkInterfacesDetails
Int -> ReadS AwsEc2InstanceNetworkInterfacesDetails
ReadS [AwsEc2InstanceNetworkInterfacesDetails]
(Int -> ReadS AwsEc2InstanceNetworkInterfacesDetails)
-> ReadS [AwsEc2InstanceNetworkInterfacesDetails]
-> ReadPrec AwsEc2InstanceNetworkInterfacesDetails
-> ReadPrec [AwsEc2InstanceNetworkInterfacesDetails]
-> Read AwsEc2InstanceNetworkInterfacesDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEc2InstanceNetworkInterfacesDetails]
$creadListPrec :: ReadPrec [AwsEc2InstanceNetworkInterfacesDetails]
readPrec :: ReadPrec AwsEc2InstanceNetworkInterfacesDetails
$creadPrec :: ReadPrec AwsEc2InstanceNetworkInterfacesDetails
readList :: ReadS [AwsEc2InstanceNetworkInterfacesDetails]
$creadList :: ReadS [AwsEc2InstanceNetworkInterfacesDetails]
readsPrec :: Int -> ReadS AwsEc2InstanceNetworkInterfacesDetails
$creadsPrec :: Int -> ReadS AwsEc2InstanceNetworkInterfacesDetails
Prelude.Read, Int -> AwsEc2InstanceNetworkInterfacesDetails -> ShowS
[AwsEc2InstanceNetworkInterfacesDetails] -> ShowS
AwsEc2InstanceNetworkInterfacesDetails -> String
(Int -> AwsEc2InstanceNetworkInterfacesDetails -> ShowS)
-> (AwsEc2InstanceNetworkInterfacesDetails -> String)
-> ([AwsEc2InstanceNetworkInterfacesDetails] -> ShowS)
-> Show AwsEc2InstanceNetworkInterfacesDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEc2InstanceNetworkInterfacesDetails] -> ShowS
$cshowList :: [AwsEc2InstanceNetworkInterfacesDetails] -> ShowS
show :: AwsEc2InstanceNetworkInterfacesDetails -> String
$cshow :: AwsEc2InstanceNetworkInterfacesDetails -> String
showsPrec :: Int -> AwsEc2InstanceNetworkInterfacesDetails -> ShowS
$cshowsPrec :: Int -> AwsEc2InstanceNetworkInterfacesDetails -> ShowS
Prelude.Show, (forall x.
 AwsEc2InstanceNetworkInterfacesDetails
 -> Rep AwsEc2InstanceNetworkInterfacesDetails x)
-> (forall x.
    Rep AwsEc2InstanceNetworkInterfacesDetails x
    -> AwsEc2InstanceNetworkInterfacesDetails)
-> Generic AwsEc2InstanceNetworkInterfacesDetails
forall x.
Rep AwsEc2InstanceNetworkInterfacesDetails x
-> AwsEc2InstanceNetworkInterfacesDetails
forall x.
AwsEc2InstanceNetworkInterfacesDetails
-> Rep AwsEc2InstanceNetworkInterfacesDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEc2InstanceNetworkInterfacesDetails x
-> AwsEc2InstanceNetworkInterfacesDetails
$cfrom :: forall x.
AwsEc2InstanceNetworkInterfacesDetails
-> Rep AwsEc2InstanceNetworkInterfacesDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEc2InstanceNetworkInterfacesDetails' 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:
--
-- 'networkInterfaceId', 'awsEc2InstanceNetworkInterfacesDetails_networkInterfaceId' - The identifier of the network interface. The details are in a
-- corresponding @AwsEc2NetworkInterfacesDetails@ object.
newAwsEc2InstanceNetworkInterfacesDetails ::
  AwsEc2InstanceNetworkInterfacesDetails
newAwsEc2InstanceNetworkInterfacesDetails :: AwsEc2InstanceNetworkInterfacesDetails
newAwsEc2InstanceNetworkInterfacesDetails =
  AwsEc2InstanceNetworkInterfacesDetails' :: Maybe Text -> AwsEc2InstanceNetworkInterfacesDetails
AwsEc2InstanceNetworkInterfacesDetails'
    { $sel:networkInterfaceId:AwsEc2InstanceNetworkInterfacesDetails' :: Maybe Text
networkInterfaceId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the network interface. The details are in a
-- corresponding @AwsEc2NetworkInterfacesDetails@ object.
awsEc2InstanceNetworkInterfacesDetails_networkInterfaceId :: Lens.Lens' AwsEc2InstanceNetworkInterfacesDetails (Prelude.Maybe Prelude.Text)
awsEc2InstanceNetworkInterfacesDetails_networkInterfaceId :: (Maybe Text -> f (Maybe Text))
-> AwsEc2InstanceNetworkInterfacesDetails
-> f AwsEc2InstanceNetworkInterfacesDetails
awsEc2InstanceNetworkInterfacesDetails_networkInterfaceId = (AwsEc2InstanceNetworkInterfacesDetails -> Maybe Text)
-> (AwsEc2InstanceNetworkInterfacesDetails
    -> Maybe Text -> AwsEc2InstanceNetworkInterfacesDetails)
-> Lens
     AwsEc2InstanceNetworkInterfacesDetails
     AwsEc2InstanceNetworkInterfacesDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2InstanceNetworkInterfacesDetails' {Maybe Text
networkInterfaceId :: Maybe Text
$sel:networkInterfaceId:AwsEc2InstanceNetworkInterfacesDetails' :: AwsEc2InstanceNetworkInterfacesDetails -> Maybe Text
networkInterfaceId} -> Maybe Text
networkInterfaceId) (\s :: AwsEc2InstanceNetworkInterfacesDetails
s@AwsEc2InstanceNetworkInterfacesDetails' {} Maybe Text
a -> AwsEc2InstanceNetworkInterfacesDetails
s {$sel:networkInterfaceId:AwsEc2InstanceNetworkInterfacesDetails' :: Maybe Text
networkInterfaceId = Maybe Text
a} :: AwsEc2InstanceNetworkInterfacesDetails)

instance
  Core.FromJSON
    AwsEc2InstanceNetworkInterfacesDetails
  where
  parseJSON :: Value -> Parser AwsEc2InstanceNetworkInterfacesDetails
parseJSON =
    String
-> (Object -> Parser AwsEc2InstanceNetworkInterfacesDetails)
-> Value
-> Parser AwsEc2InstanceNetworkInterfacesDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEc2InstanceNetworkInterfacesDetails"
      ( \Object
x ->
          Maybe Text -> AwsEc2InstanceNetworkInterfacesDetails
AwsEc2InstanceNetworkInterfacesDetails'
            (Maybe Text -> AwsEc2InstanceNetworkInterfacesDetails)
-> Parser (Maybe Text)
-> Parser AwsEc2InstanceNetworkInterfacesDetails
forall (f :: * -> *) a b. Functor 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
"NetworkInterfaceId")
      )

instance
  Prelude.Hashable
    AwsEc2InstanceNetworkInterfacesDetails

instance
  Prelude.NFData
    AwsEc2InstanceNetworkInterfacesDetails

instance
  Core.ToJSON
    AwsEc2InstanceNetworkInterfacesDetails
  where
  toJSON :: AwsEc2InstanceNetworkInterfacesDetails -> Value
toJSON AwsEc2InstanceNetworkInterfacesDetails' {Maybe Text
networkInterfaceId :: Maybe Text
$sel:networkInterfaceId:AwsEc2InstanceNetworkInterfacesDetails' :: AwsEc2InstanceNetworkInterfacesDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NetworkInterfaceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
networkInterfaceId
          ]
      )