{-# 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.NetworkAclAssociation
-- 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.NetworkAclAssociation 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 an association between a network ACL and a subnet.
--
-- /See:/ 'newNetworkAclAssociation' smart constructor.
data NetworkAclAssociation = NetworkAclAssociation'
  { -- | The ID of the association between a network ACL and a subnet.
    NetworkAclAssociation -> Maybe Text
networkAclAssociationId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the network ACL.
    NetworkAclAssociation -> Maybe Text
networkAclId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the subnet.
    NetworkAclAssociation -> Maybe Text
subnetId :: Prelude.Maybe Prelude.Text
  }
  deriving (NetworkAclAssociation -> NetworkAclAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkAclAssociation -> NetworkAclAssociation -> Bool
$c/= :: NetworkAclAssociation -> NetworkAclAssociation -> Bool
== :: NetworkAclAssociation -> NetworkAclAssociation -> Bool
$c== :: NetworkAclAssociation -> NetworkAclAssociation -> Bool
Prelude.Eq, ReadPrec [NetworkAclAssociation]
ReadPrec NetworkAclAssociation
Int -> ReadS NetworkAclAssociation
ReadS [NetworkAclAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkAclAssociation]
$creadListPrec :: ReadPrec [NetworkAclAssociation]
readPrec :: ReadPrec NetworkAclAssociation
$creadPrec :: ReadPrec NetworkAclAssociation
readList :: ReadS [NetworkAclAssociation]
$creadList :: ReadS [NetworkAclAssociation]
readsPrec :: Int -> ReadS NetworkAclAssociation
$creadsPrec :: Int -> ReadS NetworkAclAssociation
Prelude.Read, Int -> NetworkAclAssociation -> ShowS
[NetworkAclAssociation] -> ShowS
NetworkAclAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkAclAssociation] -> ShowS
$cshowList :: [NetworkAclAssociation] -> ShowS
show :: NetworkAclAssociation -> String
$cshow :: NetworkAclAssociation -> String
showsPrec :: Int -> NetworkAclAssociation -> ShowS
$cshowsPrec :: Int -> NetworkAclAssociation -> ShowS
Prelude.Show, forall x. Rep NetworkAclAssociation x -> NetworkAclAssociation
forall x. NetworkAclAssociation -> Rep NetworkAclAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkAclAssociation x -> NetworkAclAssociation
$cfrom :: forall x. NetworkAclAssociation -> Rep NetworkAclAssociation x
Prelude.Generic)

-- |
-- Create a value of 'NetworkAclAssociation' 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:
--
-- 'networkAclAssociationId', 'networkAclAssociation_networkAclAssociationId' - The ID of the association between a network ACL and a subnet.
--
-- 'networkAclId', 'networkAclAssociation_networkAclId' - The ID of the network ACL.
--
-- 'subnetId', 'networkAclAssociation_subnetId' - The ID of the subnet.
newNetworkAclAssociation ::
  NetworkAclAssociation
newNetworkAclAssociation :: NetworkAclAssociation
newNetworkAclAssociation =
  NetworkAclAssociation'
    { $sel:networkAclAssociationId:NetworkAclAssociation' :: Maybe Text
networkAclAssociationId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:networkAclId:NetworkAclAssociation' :: Maybe Text
networkAclId = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetId:NetworkAclAssociation' :: Maybe Text
subnetId = forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | The ID of the subnet.
networkAclAssociation_subnetId :: Lens.Lens' NetworkAclAssociation (Prelude.Maybe Prelude.Text)
networkAclAssociation_subnetId :: Lens' NetworkAclAssociation (Maybe Text)
networkAclAssociation_subnetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkAclAssociation' {Maybe Text
subnetId :: Maybe Text
$sel:subnetId:NetworkAclAssociation' :: NetworkAclAssociation -> Maybe Text
subnetId} -> Maybe Text
subnetId) (\s :: NetworkAclAssociation
s@NetworkAclAssociation' {} Maybe Text
a -> NetworkAclAssociation
s {$sel:subnetId:NetworkAclAssociation' :: Maybe Text
subnetId = Maybe Text
a} :: NetworkAclAssociation)

instance Data.FromXML NetworkAclAssociation where
  parseXML :: [Node] -> Either String NetworkAclAssociation
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> NetworkAclAssociation
NetworkAclAssociation'
      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
"networkAclAssociationId")
      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
"networkAclId")
      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
"subnetId")

instance Prelude.Hashable NetworkAclAssociation where
  hashWithSalt :: Int -> NetworkAclAssociation -> Int
hashWithSalt Int
_salt NetworkAclAssociation' {Maybe Text
subnetId :: Maybe Text
networkAclId :: Maybe Text
networkAclAssociationId :: Maybe Text
$sel:subnetId:NetworkAclAssociation' :: NetworkAclAssociation -> Maybe Text
$sel:networkAclId:NetworkAclAssociation' :: NetworkAclAssociation -> Maybe Text
$sel:networkAclAssociationId:NetworkAclAssociation' :: NetworkAclAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
networkAclAssociationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
networkAclId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subnetId

instance Prelude.NFData NetworkAclAssociation where
  rnf :: NetworkAclAssociation -> ()
rnf NetworkAclAssociation' {Maybe Text
subnetId :: Maybe Text
networkAclId :: Maybe Text
networkAclAssociationId :: Maybe Text
$sel:subnetId:NetworkAclAssociation' :: NetworkAclAssociation -> Maybe Text
$sel:networkAclId:NetworkAclAssociation' :: NetworkAclAssociation -> Maybe Text
$sel:networkAclAssociationId:NetworkAclAssociation' :: NetworkAclAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
networkAclAssociationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
networkAclId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subnetId