{-# 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.PrefixListId
-- 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.PrefixListId 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 a prefix list ID.
--
-- /See:/ 'newPrefixListId' smart constructor.
data PrefixListId = PrefixListId'
  { -- | A description for the security group rule that references this prefix
    -- list ID.
    --
    -- Constraints: Up to 255 characters in length. Allowed characters are a-z,
    -- A-Z, 0-9, spaces, and ._-:\/()#,\@[]+=;{}!$*
    PrefixListId -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the prefix.
    PrefixListId -> Maybe Text
prefixListId :: Prelude.Maybe Prelude.Text
  }
  deriving (PrefixListId -> PrefixListId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrefixListId -> PrefixListId -> Bool
$c/= :: PrefixListId -> PrefixListId -> Bool
== :: PrefixListId -> PrefixListId -> Bool
$c== :: PrefixListId -> PrefixListId -> Bool
Prelude.Eq, ReadPrec [PrefixListId]
ReadPrec PrefixListId
Int -> ReadS PrefixListId
ReadS [PrefixListId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrefixListId]
$creadListPrec :: ReadPrec [PrefixListId]
readPrec :: ReadPrec PrefixListId
$creadPrec :: ReadPrec PrefixListId
readList :: ReadS [PrefixListId]
$creadList :: ReadS [PrefixListId]
readsPrec :: Int -> ReadS PrefixListId
$creadsPrec :: Int -> ReadS PrefixListId
Prelude.Read, Int -> PrefixListId -> ShowS
[PrefixListId] -> ShowS
PrefixListId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrefixListId] -> ShowS
$cshowList :: [PrefixListId] -> ShowS
show :: PrefixListId -> String
$cshow :: PrefixListId -> String
showsPrec :: Int -> PrefixListId -> ShowS
$cshowsPrec :: Int -> PrefixListId -> ShowS
Prelude.Show, forall x. Rep PrefixListId x -> PrefixListId
forall x. PrefixListId -> Rep PrefixListId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PrefixListId x -> PrefixListId
$cfrom :: forall x. PrefixListId -> Rep PrefixListId x
Prelude.Generic)

-- |
-- Create a value of 'PrefixListId' 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:
--
-- 'description', 'prefixListId_description' - A description for the security group rule that references this prefix
-- list ID.
--
-- Constraints: Up to 255 characters in length. Allowed characters are a-z,
-- A-Z, 0-9, spaces, and ._-:\/()#,\@[]+=;{}!$*
--
-- 'prefixListId', 'prefixListId_prefixListId' - The ID of the prefix.
newPrefixListId ::
  PrefixListId
newPrefixListId :: PrefixListId
newPrefixListId =
  PrefixListId'
    { $sel:description:PrefixListId' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:prefixListId:PrefixListId' :: Maybe Text
prefixListId = forall a. Maybe a
Prelude.Nothing
    }

-- | A description for the security group rule that references this prefix
-- list ID.
--
-- Constraints: Up to 255 characters in length. Allowed characters are a-z,
-- A-Z, 0-9, spaces, and ._-:\/()#,\@[]+=;{}!$*
prefixListId_description :: Lens.Lens' PrefixListId (Prelude.Maybe Prelude.Text)
prefixListId_description :: Lens' PrefixListId (Maybe Text)
prefixListId_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrefixListId' {Maybe Text
description :: Maybe Text
$sel:description:PrefixListId' :: PrefixListId -> Maybe Text
description} -> Maybe Text
description) (\s :: PrefixListId
s@PrefixListId' {} Maybe Text
a -> PrefixListId
s {$sel:description:PrefixListId' :: Maybe Text
description = Maybe Text
a} :: PrefixListId)

-- | The ID of the prefix.
prefixListId_prefixListId :: Lens.Lens' PrefixListId (Prelude.Maybe Prelude.Text)
prefixListId_prefixListId :: Lens' PrefixListId (Maybe Text)
prefixListId_prefixListId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrefixListId' {Maybe Text
prefixListId :: Maybe Text
$sel:prefixListId:PrefixListId' :: PrefixListId -> Maybe Text
prefixListId} -> Maybe Text
prefixListId) (\s :: PrefixListId
s@PrefixListId' {} Maybe Text
a -> PrefixListId
s {$sel:prefixListId:PrefixListId' :: Maybe Text
prefixListId = Maybe Text
a} :: PrefixListId)

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

instance Prelude.Hashable PrefixListId where
  hashWithSalt :: Int -> PrefixListId -> Int
hashWithSalt Int
_salt PrefixListId' {Maybe Text
prefixListId :: Maybe Text
description :: Maybe Text
$sel:prefixListId:PrefixListId' :: PrefixListId -> Maybe Text
$sel:description:PrefixListId' :: PrefixListId -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
prefixListId

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

instance Data.ToQuery PrefixListId where
  toQuery :: PrefixListId -> QueryString
toQuery PrefixListId' {Maybe Text
prefixListId :: Maybe Text
description :: Maybe Text
$sel:prefixListId:PrefixListId' :: PrefixListId -> Maybe Text
$sel:description:PrefixListId' :: PrefixListId -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Description" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
description,
        ByteString
"PrefixListId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
prefixListId
      ]