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

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

-- | An association between the network ACL and a subnet.
--
-- /See:/ 'newAwsEc2NetworkAclAssociation' smart constructor.
data AwsEc2NetworkAclAssociation = AwsEc2NetworkAclAssociation'
  { -- | The identifier of the network ACL.
    AwsEc2NetworkAclAssociation -> Maybe Text
networkAclId :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the subnet that is associated with the network ACL.
    AwsEc2NetworkAclAssociation -> Maybe Text
subnetId :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the association between the network ACL and the
    -- subnet.
    AwsEc2NetworkAclAssociation -> Maybe Text
networkAclAssociationId :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsEc2NetworkAclAssociation -> AwsEc2NetworkAclAssociation -> Bool
(AwsEc2NetworkAclAssociation
 -> AwsEc2NetworkAclAssociation -> Bool)
-> (AwsEc2NetworkAclAssociation
    -> AwsEc2NetworkAclAssociation -> Bool)
-> Eq AwsEc2NetworkAclAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEc2NetworkAclAssociation -> AwsEc2NetworkAclAssociation -> Bool
$c/= :: AwsEc2NetworkAclAssociation -> AwsEc2NetworkAclAssociation -> Bool
== :: AwsEc2NetworkAclAssociation -> AwsEc2NetworkAclAssociation -> Bool
$c== :: AwsEc2NetworkAclAssociation -> AwsEc2NetworkAclAssociation -> Bool
Prelude.Eq, ReadPrec [AwsEc2NetworkAclAssociation]
ReadPrec AwsEc2NetworkAclAssociation
Int -> ReadS AwsEc2NetworkAclAssociation
ReadS [AwsEc2NetworkAclAssociation]
(Int -> ReadS AwsEc2NetworkAclAssociation)
-> ReadS [AwsEc2NetworkAclAssociation]
-> ReadPrec AwsEc2NetworkAclAssociation
-> ReadPrec [AwsEc2NetworkAclAssociation]
-> Read AwsEc2NetworkAclAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEc2NetworkAclAssociation]
$creadListPrec :: ReadPrec [AwsEc2NetworkAclAssociation]
readPrec :: ReadPrec AwsEc2NetworkAclAssociation
$creadPrec :: ReadPrec AwsEc2NetworkAclAssociation
readList :: ReadS [AwsEc2NetworkAclAssociation]
$creadList :: ReadS [AwsEc2NetworkAclAssociation]
readsPrec :: Int -> ReadS AwsEc2NetworkAclAssociation
$creadsPrec :: Int -> ReadS AwsEc2NetworkAclAssociation
Prelude.Read, Int -> AwsEc2NetworkAclAssociation -> ShowS
[AwsEc2NetworkAclAssociation] -> ShowS
AwsEc2NetworkAclAssociation -> String
(Int -> AwsEc2NetworkAclAssociation -> ShowS)
-> (AwsEc2NetworkAclAssociation -> String)
-> ([AwsEc2NetworkAclAssociation] -> ShowS)
-> Show AwsEc2NetworkAclAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEc2NetworkAclAssociation] -> ShowS
$cshowList :: [AwsEc2NetworkAclAssociation] -> ShowS
show :: AwsEc2NetworkAclAssociation -> String
$cshow :: AwsEc2NetworkAclAssociation -> String
showsPrec :: Int -> AwsEc2NetworkAclAssociation -> ShowS
$cshowsPrec :: Int -> AwsEc2NetworkAclAssociation -> ShowS
Prelude.Show, (forall x.
 AwsEc2NetworkAclAssociation -> Rep AwsEc2NetworkAclAssociation x)
-> (forall x.
    Rep AwsEc2NetworkAclAssociation x -> AwsEc2NetworkAclAssociation)
-> Generic AwsEc2NetworkAclAssociation
forall x.
Rep AwsEc2NetworkAclAssociation x -> AwsEc2NetworkAclAssociation
forall x.
AwsEc2NetworkAclAssociation -> Rep AwsEc2NetworkAclAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEc2NetworkAclAssociation x -> AwsEc2NetworkAclAssociation
$cfrom :: forall x.
AwsEc2NetworkAclAssociation -> Rep AwsEc2NetworkAclAssociation x
Prelude.Generic)

-- |
-- Create a value of 'AwsEc2NetworkAclAssociation' 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:
--
-- 'networkAclId', 'awsEc2NetworkAclAssociation_networkAclId' - The identifier of the network ACL.
--
-- 'subnetId', 'awsEc2NetworkAclAssociation_subnetId' - The identifier of the subnet that is associated with the network ACL.
--
-- 'networkAclAssociationId', 'awsEc2NetworkAclAssociation_networkAclAssociationId' - The identifier of the association between the network ACL and the
-- subnet.
newAwsEc2NetworkAclAssociation ::
  AwsEc2NetworkAclAssociation
newAwsEc2NetworkAclAssociation :: AwsEc2NetworkAclAssociation
newAwsEc2NetworkAclAssociation =
  AwsEc2NetworkAclAssociation' :: Maybe Text
-> Maybe Text -> Maybe Text -> AwsEc2NetworkAclAssociation
AwsEc2NetworkAclAssociation'
    { $sel:networkAclId:AwsEc2NetworkAclAssociation' :: Maybe Text
networkAclId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetId:AwsEc2NetworkAclAssociation' :: Maybe Text
subnetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:networkAclAssociationId:AwsEc2NetworkAclAssociation' :: Maybe Text
networkAclAssociationId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the network ACL.
awsEc2NetworkAclAssociation_networkAclId :: Lens.Lens' AwsEc2NetworkAclAssociation (Prelude.Maybe Prelude.Text)
awsEc2NetworkAclAssociation_networkAclId :: (Maybe Text -> f (Maybe Text))
-> AwsEc2NetworkAclAssociation -> f AwsEc2NetworkAclAssociation
awsEc2NetworkAclAssociation_networkAclId = (AwsEc2NetworkAclAssociation -> Maybe Text)
-> (AwsEc2NetworkAclAssociation
    -> Maybe Text -> AwsEc2NetworkAclAssociation)
-> Lens
     AwsEc2NetworkAclAssociation
     AwsEc2NetworkAclAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2NetworkAclAssociation' {Maybe Text
networkAclId :: Maybe Text
$sel:networkAclId:AwsEc2NetworkAclAssociation' :: AwsEc2NetworkAclAssociation -> Maybe Text
networkAclId} -> Maybe Text
networkAclId) (\s :: AwsEc2NetworkAclAssociation
s@AwsEc2NetworkAclAssociation' {} Maybe Text
a -> AwsEc2NetworkAclAssociation
s {$sel:networkAclId:AwsEc2NetworkAclAssociation' :: Maybe Text
networkAclId = Maybe Text
a} :: AwsEc2NetworkAclAssociation)

-- | The identifier of the subnet that is associated with the network ACL.
awsEc2NetworkAclAssociation_subnetId :: Lens.Lens' AwsEc2NetworkAclAssociation (Prelude.Maybe Prelude.Text)
awsEc2NetworkAclAssociation_subnetId :: (Maybe Text -> f (Maybe Text))
-> AwsEc2NetworkAclAssociation -> f AwsEc2NetworkAclAssociation
awsEc2NetworkAclAssociation_subnetId = (AwsEc2NetworkAclAssociation -> Maybe Text)
-> (AwsEc2NetworkAclAssociation
    -> Maybe Text -> AwsEc2NetworkAclAssociation)
-> Lens
     AwsEc2NetworkAclAssociation
     AwsEc2NetworkAclAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2NetworkAclAssociation' {Maybe Text
subnetId :: Maybe Text
$sel:subnetId:AwsEc2NetworkAclAssociation' :: AwsEc2NetworkAclAssociation -> Maybe Text
subnetId} -> Maybe Text
subnetId) (\s :: AwsEc2NetworkAclAssociation
s@AwsEc2NetworkAclAssociation' {} Maybe Text
a -> AwsEc2NetworkAclAssociation
s {$sel:subnetId:AwsEc2NetworkAclAssociation' :: Maybe Text
subnetId = Maybe Text
a} :: AwsEc2NetworkAclAssociation)

-- | The identifier of the association between the network ACL and the
-- subnet.
awsEc2NetworkAclAssociation_networkAclAssociationId :: Lens.Lens' AwsEc2NetworkAclAssociation (Prelude.Maybe Prelude.Text)
awsEc2NetworkAclAssociation_networkAclAssociationId :: (Maybe Text -> f (Maybe Text))
-> AwsEc2NetworkAclAssociation -> f AwsEc2NetworkAclAssociation
awsEc2NetworkAclAssociation_networkAclAssociationId = (AwsEc2NetworkAclAssociation -> Maybe Text)
-> (AwsEc2NetworkAclAssociation
    -> Maybe Text -> AwsEc2NetworkAclAssociation)
-> Lens
     AwsEc2NetworkAclAssociation
     AwsEc2NetworkAclAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2NetworkAclAssociation' {Maybe Text
networkAclAssociationId :: Maybe Text
$sel:networkAclAssociationId:AwsEc2NetworkAclAssociation' :: AwsEc2NetworkAclAssociation -> Maybe Text
networkAclAssociationId} -> Maybe Text
networkAclAssociationId) (\s :: AwsEc2NetworkAclAssociation
s@AwsEc2NetworkAclAssociation' {} Maybe Text
a -> AwsEc2NetworkAclAssociation
s {$sel:networkAclAssociationId:AwsEc2NetworkAclAssociation' :: Maybe Text
networkAclAssociationId = Maybe Text
a} :: AwsEc2NetworkAclAssociation)

instance Core.FromJSON AwsEc2NetworkAclAssociation where
  parseJSON :: Value -> Parser AwsEc2NetworkAclAssociation
parseJSON =
    String
-> (Object -> Parser AwsEc2NetworkAclAssociation)
-> Value
-> Parser AwsEc2NetworkAclAssociation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEc2NetworkAclAssociation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> AwsEc2NetworkAclAssociation
AwsEc2NetworkAclAssociation'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> AwsEc2NetworkAclAssociation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> AwsEc2NetworkAclAssociation)
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
"NetworkAclId")
            Parser (Maybe Text -> Maybe Text -> AwsEc2NetworkAclAssociation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsEc2NetworkAclAssociation)
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
"SubnetId")
            Parser (Maybe Text -> AwsEc2NetworkAclAssociation)
-> Parser (Maybe Text) -> Parser AwsEc2NetworkAclAssociation
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
"NetworkAclAssociationId")
      )

instance Prelude.Hashable AwsEc2NetworkAclAssociation

instance Prelude.NFData AwsEc2NetworkAclAssociation

instance Core.ToJSON AwsEc2NetworkAclAssociation where
  toJSON :: AwsEc2NetworkAclAssociation -> Value
toJSON AwsEc2NetworkAclAssociation' {Maybe Text
networkAclAssociationId :: Maybe Text
subnetId :: Maybe Text
networkAclId :: Maybe Text
$sel:networkAclAssociationId:AwsEc2NetworkAclAssociation' :: AwsEc2NetworkAclAssociation -> Maybe Text
$sel:subnetId:AwsEc2NetworkAclAssociation' :: AwsEc2NetworkAclAssociation -> Maybe Text
$sel:networkAclId:AwsEc2NetworkAclAssociation' :: AwsEc2NetworkAclAssociation -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NetworkAclId" 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
networkAclId,
            (Text
"SubnetId" 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
subnetId,
            (Text
"NetworkAclAssociationId" 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
networkAclAssociationId
          ]
      )