{-# 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.Ipv4PrefixSpecificationRequest
-- 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.Ipv4PrefixSpecificationRequest 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 IPv4 prefix option for a network interface.
--
-- /See:/ 'newIpv4PrefixSpecificationRequest' smart constructor.
data Ipv4PrefixSpecificationRequest = Ipv4PrefixSpecificationRequest'
  { -- | The IPv4 prefix. For information, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-prefix-eni.html Assigning prefixes to Amazon EC2 network interfaces>
    -- in the /Amazon Elastic Compute Cloud User Guide/.
    Ipv4PrefixSpecificationRequest -> Maybe Text
ipv4Prefix :: Prelude.Maybe Prelude.Text
  }
  deriving (Ipv4PrefixSpecificationRequest
-> Ipv4PrefixSpecificationRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ipv4PrefixSpecificationRequest
-> Ipv4PrefixSpecificationRequest -> Bool
$c/= :: Ipv4PrefixSpecificationRequest
-> Ipv4PrefixSpecificationRequest -> Bool
== :: Ipv4PrefixSpecificationRequest
-> Ipv4PrefixSpecificationRequest -> Bool
$c== :: Ipv4PrefixSpecificationRequest
-> Ipv4PrefixSpecificationRequest -> Bool
Prelude.Eq, ReadPrec [Ipv4PrefixSpecificationRequest]
ReadPrec Ipv4PrefixSpecificationRequest
Int -> ReadS Ipv4PrefixSpecificationRequest
ReadS [Ipv4PrefixSpecificationRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Ipv4PrefixSpecificationRequest]
$creadListPrec :: ReadPrec [Ipv4PrefixSpecificationRequest]
readPrec :: ReadPrec Ipv4PrefixSpecificationRequest
$creadPrec :: ReadPrec Ipv4PrefixSpecificationRequest
readList :: ReadS [Ipv4PrefixSpecificationRequest]
$creadList :: ReadS [Ipv4PrefixSpecificationRequest]
readsPrec :: Int -> ReadS Ipv4PrefixSpecificationRequest
$creadsPrec :: Int -> ReadS Ipv4PrefixSpecificationRequest
Prelude.Read, Int -> Ipv4PrefixSpecificationRequest -> ShowS
[Ipv4PrefixSpecificationRequest] -> ShowS
Ipv4PrefixSpecificationRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ipv4PrefixSpecificationRequest] -> ShowS
$cshowList :: [Ipv4PrefixSpecificationRequest] -> ShowS
show :: Ipv4PrefixSpecificationRequest -> String
$cshow :: Ipv4PrefixSpecificationRequest -> String
showsPrec :: Int -> Ipv4PrefixSpecificationRequest -> ShowS
$cshowsPrec :: Int -> Ipv4PrefixSpecificationRequest -> ShowS
Prelude.Show, forall x.
Rep Ipv4PrefixSpecificationRequest x
-> Ipv4PrefixSpecificationRequest
forall x.
Ipv4PrefixSpecificationRequest
-> Rep Ipv4PrefixSpecificationRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep Ipv4PrefixSpecificationRequest x
-> Ipv4PrefixSpecificationRequest
$cfrom :: forall x.
Ipv4PrefixSpecificationRequest
-> Rep Ipv4PrefixSpecificationRequest x
Prelude.Generic)

-- |
-- Create a value of 'Ipv4PrefixSpecificationRequest' 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:
--
-- 'ipv4Prefix', 'ipv4PrefixSpecificationRequest_ipv4Prefix' - The IPv4 prefix. For information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-prefix-eni.html Assigning prefixes to Amazon EC2 network interfaces>
-- in the /Amazon Elastic Compute Cloud User Guide/.
newIpv4PrefixSpecificationRequest ::
  Ipv4PrefixSpecificationRequest
newIpv4PrefixSpecificationRequest :: Ipv4PrefixSpecificationRequest
newIpv4PrefixSpecificationRequest =
  Ipv4PrefixSpecificationRequest'
    { $sel:ipv4Prefix:Ipv4PrefixSpecificationRequest' :: Maybe Text
ipv4Prefix =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The IPv4 prefix. For information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-prefix-eni.html Assigning prefixes to Amazon EC2 network interfaces>
-- in the /Amazon Elastic Compute Cloud User Guide/.
ipv4PrefixSpecificationRequest_ipv4Prefix :: Lens.Lens' Ipv4PrefixSpecificationRequest (Prelude.Maybe Prelude.Text)
ipv4PrefixSpecificationRequest_ipv4Prefix :: Lens' Ipv4PrefixSpecificationRequest (Maybe Text)
ipv4PrefixSpecificationRequest_ipv4Prefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ipv4PrefixSpecificationRequest' {Maybe Text
ipv4Prefix :: Maybe Text
$sel:ipv4Prefix:Ipv4PrefixSpecificationRequest' :: Ipv4PrefixSpecificationRequest -> Maybe Text
ipv4Prefix} -> Maybe Text
ipv4Prefix) (\s :: Ipv4PrefixSpecificationRequest
s@Ipv4PrefixSpecificationRequest' {} Maybe Text
a -> Ipv4PrefixSpecificationRequest
s {$sel:ipv4Prefix:Ipv4PrefixSpecificationRequest' :: Maybe Text
ipv4Prefix = Maybe Text
a} :: Ipv4PrefixSpecificationRequest)

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

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

instance
  Prelude.NFData
    Ipv4PrefixSpecificationRequest
  where
  rnf :: Ipv4PrefixSpecificationRequest -> ()
rnf Ipv4PrefixSpecificationRequest' {Maybe Text
ipv4Prefix :: Maybe Text
$sel:ipv4Prefix:Ipv4PrefixSpecificationRequest' :: Ipv4PrefixSpecificationRequest -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ipv4Prefix

instance Data.ToQuery Ipv4PrefixSpecificationRequest where
  toQuery :: Ipv4PrefixSpecificationRequest -> QueryString
toQuery Ipv4PrefixSpecificationRequest' {Maybe Text
ipv4Prefix :: Maybe Text
$sel:ipv4Prefix:Ipv4PrefixSpecificationRequest' :: Ipv4PrefixSpecificationRequest -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"Ipv4Prefix" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
ipv4Prefix]