{-# 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.PrefixListAssociation
-- 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.PrefixListAssociation 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 resource with which a prefix list is associated.
--
-- /See:/ 'newPrefixListAssociation' smart constructor.
data PrefixListAssociation = PrefixListAssociation'
  { -- | The ID of the resource.
    PrefixListAssociation -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | The owner of the resource.
    PrefixListAssociation -> Maybe Text
resourceOwner :: Prelude.Maybe Prelude.Text
  }
  deriving (PrefixListAssociation -> PrefixListAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrefixListAssociation -> PrefixListAssociation -> Bool
$c/= :: PrefixListAssociation -> PrefixListAssociation -> Bool
== :: PrefixListAssociation -> PrefixListAssociation -> Bool
$c== :: PrefixListAssociation -> PrefixListAssociation -> Bool
Prelude.Eq, ReadPrec [PrefixListAssociation]
ReadPrec PrefixListAssociation
Int -> ReadS PrefixListAssociation
ReadS [PrefixListAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrefixListAssociation]
$creadListPrec :: ReadPrec [PrefixListAssociation]
readPrec :: ReadPrec PrefixListAssociation
$creadPrec :: ReadPrec PrefixListAssociation
readList :: ReadS [PrefixListAssociation]
$creadList :: ReadS [PrefixListAssociation]
readsPrec :: Int -> ReadS PrefixListAssociation
$creadsPrec :: Int -> ReadS PrefixListAssociation
Prelude.Read, Int -> PrefixListAssociation -> ShowS
[PrefixListAssociation] -> ShowS
PrefixListAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrefixListAssociation] -> ShowS
$cshowList :: [PrefixListAssociation] -> ShowS
show :: PrefixListAssociation -> String
$cshow :: PrefixListAssociation -> String
showsPrec :: Int -> PrefixListAssociation -> ShowS
$cshowsPrec :: Int -> PrefixListAssociation -> ShowS
Prelude.Show, forall x. Rep PrefixListAssociation x -> PrefixListAssociation
forall x. PrefixListAssociation -> Rep PrefixListAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PrefixListAssociation x -> PrefixListAssociation
$cfrom :: forall x. PrefixListAssociation -> Rep PrefixListAssociation x
Prelude.Generic)

-- |
-- Create a value of 'PrefixListAssociation' 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:
--
-- 'resourceId', 'prefixListAssociation_resourceId' - The ID of the resource.
--
-- 'resourceOwner', 'prefixListAssociation_resourceOwner' - The owner of the resource.
newPrefixListAssociation ::
  PrefixListAssociation
newPrefixListAssociation :: PrefixListAssociation
newPrefixListAssociation =
  PrefixListAssociation'
    { $sel:resourceId:PrefixListAssociation' :: Maybe Text
resourceId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceOwner:PrefixListAssociation' :: Maybe Text
resourceOwner = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the resource.
prefixListAssociation_resourceId :: Lens.Lens' PrefixListAssociation (Prelude.Maybe Prelude.Text)
prefixListAssociation_resourceId :: Lens' PrefixListAssociation (Maybe Text)
prefixListAssociation_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrefixListAssociation' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:PrefixListAssociation' :: PrefixListAssociation -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: PrefixListAssociation
s@PrefixListAssociation' {} Maybe Text
a -> PrefixListAssociation
s {$sel:resourceId:PrefixListAssociation' :: Maybe Text
resourceId = Maybe Text
a} :: PrefixListAssociation)

-- | The owner of the resource.
prefixListAssociation_resourceOwner :: Lens.Lens' PrefixListAssociation (Prelude.Maybe Prelude.Text)
prefixListAssociation_resourceOwner :: Lens' PrefixListAssociation (Maybe Text)
prefixListAssociation_resourceOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrefixListAssociation' {Maybe Text
resourceOwner :: Maybe Text
$sel:resourceOwner:PrefixListAssociation' :: PrefixListAssociation -> Maybe Text
resourceOwner} -> Maybe Text
resourceOwner) (\s :: PrefixListAssociation
s@PrefixListAssociation' {} Maybe Text
a -> PrefixListAssociation
s {$sel:resourceOwner:PrefixListAssociation' :: Maybe Text
resourceOwner = Maybe Text
a} :: PrefixListAssociation)

instance Data.FromXML PrefixListAssociation where
  parseXML :: [Node] -> Either String PrefixListAssociation
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> PrefixListAssociation
PrefixListAssociation'
      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
"resourceId")
      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
"resourceOwner")

instance Prelude.Hashable PrefixListAssociation where
  hashWithSalt :: Int -> PrefixListAssociation -> Int
hashWithSalt Int
_salt PrefixListAssociation' {Maybe Text
resourceOwner :: Maybe Text
resourceId :: Maybe Text
$sel:resourceOwner:PrefixListAssociation' :: PrefixListAssociation -> Maybe Text
$sel:resourceId:PrefixListAssociation' :: PrefixListAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceOwner

instance Prelude.NFData PrefixListAssociation where
  rnf :: PrefixListAssociation -> ()
rnf PrefixListAssociation' {Maybe Text
resourceOwner :: Maybe Text
resourceId :: Maybe Text
$sel:resourceOwner:PrefixListAssociation' :: PrefixListAssociation -> Maybe Text
$sel:resourceId:PrefixListAssociation' :: PrefixListAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceOwner