{-# 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.AddressAttribute
-- 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.AddressAttribute 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 Amazonka.EC2.Types.PtrUpdateStatus
import qualified Amazonka.Prelude as Prelude

-- | The attributes associated with an Elastic IP address.
--
-- /See:/ 'newAddressAttribute' smart constructor.
data AddressAttribute = AddressAttribute'
  { -- | [EC2-VPC] The allocation ID.
    AddressAttribute -> Maybe Text
allocationId :: Prelude.Maybe Prelude.Text,
    -- | The pointer (PTR) record for the IP address.
    AddressAttribute -> Maybe Text
ptrRecord :: Prelude.Maybe Prelude.Text,
    -- | The updated PTR record for the IP address.
    AddressAttribute -> Maybe PtrUpdateStatus
ptrRecordUpdate :: Prelude.Maybe PtrUpdateStatus,
    -- | The public IP address.
    AddressAttribute -> Maybe Text
publicIp :: Prelude.Maybe Prelude.Text
  }
  deriving (AddressAttribute -> AddressAttribute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddressAttribute -> AddressAttribute -> Bool
$c/= :: AddressAttribute -> AddressAttribute -> Bool
== :: AddressAttribute -> AddressAttribute -> Bool
$c== :: AddressAttribute -> AddressAttribute -> Bool
Prelude.Eq, ReadPrec [AddressAttribute]
ReadPrec AddressAttribute
Int -> ReadS AddressAttribute
ReadS [AddressAttribute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddressAttribute]
$creadListPrec :: ReadPrec [AddressAttribute]
readPrec :: ReadPrec AddressAttribute
$creadPrec :: ReadPrec AddressAttribute
readList :: ReadS [AddressAttribute]
$creadList :: ReadS [AddressAttribute]
readsPrec :: Int -> ReadS AddressAttribute
$creadsPrec :: Int -> ReadS AddressAttribute
Prelude.Read, Int -> AddressAttribute -> ShowS
[AddressAttribute] -> ShowS
AddressAttribute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddressAttribute] -> ShowS
$cshowList :: [AddressAttribute] -> ShowS
show :: AddressAttribute -> String
$cshow :: AddressAttribute -> String
showsPrec :: Int -> AddressAttribute -> ShowS
$cshowsPrec :: Int -> AddressAttribute -> ShowS
Prelude.Show, forall x. Rep AddressAttribute x -> AddressAttribute
forall x. AddressAttribute -> Rep AddressAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddressAttribute x -> AddressAttribute
$cfrom :: forall x. AddressAttribute -> Rep AddressAttribute x
Prelude.Generic)

-- |
-- Create a value of 'AddressAttribute' 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:
--
-- 'allocationId', 'addressAttribute_allocationId' - [EC2-VPC] The allocation ID.
--
-- 'ptrRecord', 'addressAttribute_ptrRecord' - The pointer (PTR) record for the IP address.
--
-- 'ptrRecordUpdate', 'addressAttribute_ptrRecordUpdate' - The updated PTR record for the IP address.
--
-- 'publicIp', 'addressAttribute_publicIp' - The public IP address.
newAddressAttribute ::
  AddressAttribute
newAddressAttribute :: AddressAttribute
newAddressAttribute =
  AddressAttribute'
    { $sel:allocationId:AddressAttribute' :: Maybe Text
allocationId = forall a. Maybe a
Prelude.Nothing,
      $sel:ptrRecord:AddressAttribute' :: Maybe Text
ptrRecord = forall a. Maybe a
Prelude.Nothing,
      $sel:ptrRecordUpdate:AddressAttribute' :: Maybe PtrUpdateStatus
ptrRecordUpdate = forall a. Maybe a
Prelude.Nothing,
      $sel:publicIp:AddressAttribute' :: Maybe Text
publicIp = forall a. Maybe a
Prelude.Nothing
    }

-- | [EC2-VPC] The allocation ID.
addressAttribute_allocationId :: Lens.Lens' AddressAttribute (Prelude.Maybe Prelude.Text)
addressAttribute_allocationId :: Lens' AddressAttribute (Maybe Text)
addressAttribute_allocationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddressAttribute' {Maybe Text
allocationId :: Maybe Text
$sel:allocationId:AddressAttribute' :: AddressAttribute -> Maybe Text
allocationId} -> Maybe Text
allocationId) (\s :: AddressAttribute
s@AddressAttribute' {} Maybe Text
a -> AddressAttribute
s {$sel:allocationId:AddressAttribute' :: Maybe Text
allocationId = Maybe Text
a} :: AddressAttribute)

-- | The pointer (PTR) record for the IP address.
addressAttribute_ptrRecord :: Lens.Lens' AddressAttribute (Prelude.Maybe Prelude.Text)
addressAttribute_ptrRecord :: Lens' AddressAttribute (Maybe Text)
addressAttribute_ptrRecord = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddressAttribute' {Maybe Text
ptrRecord :: Maybe Text
$sel:ptrRecord:AddressAttribute' :: AddressAttribute -> Maybe Text
ptrRecord} -> Maybe Text
ptrRecord) (\s :: AddressAttribute
s@AddressAttribute' {} Maybe Text
a -> AddressAttribute
s {$sel:ptrRecord:AddressAttribute' :: Maybe Text
ptrRecord = Maybe Text
a} :: AddressAttribute)

-- | The updated PTR record for the IP address.
addressAttribute_ptrRecordUpdate :: Lens.Lens' AddressAttribute (Prelude.Maybe PtrUpdateStatus)
addressAttribute_ptrRecordUpdate :: Lens' AddressAttribute (Maybe PtrUpdateStatus)
addressAttribute_ptrRecordUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddressAttribute' {Maybe PtrUpdateStatus
ptrRecordUpdate :: Maybe PtrUpdateStatus
$sel:ptrRecordUpdate:AddressAttribute' :: AddressAttribute -> Maybe PtrUpdateStatus
ptrRecordUpdate} -> Maybe PtrUpdateStatus
ptrRecordUpdate) (\s :: AddressAttribute
s@AddressAttribute' {} Maybe PtrUpdateStatus
a -> AddressAttribute
s {$sel:ptrRecordUpdate:AddressAttribute' :: Maybe PtrUpdateStatus
ptrRecordUpdate = Maybe PtrUpdateStatus
a} :: AddressAttribute)

-- | The public IP address.
addressAttribute_publicIp :: Lens.Lens' AddressAttribute (Prelude.Maybe Prelude.Text)
addressAttribute_publicIp :: Lens' AddressAttribute (Maybe Text)
addressAttribute_publicIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddressAttribute' {Maybe Text
publicIp :: Maybe Text
$sel:publicIp:AddressAttribute' :: AddressAttribute -> Maybe Text
publicIp} -> Maybe Text
publicIp) (\s :: AddressAttribute
s@AddressAttribute' {} Maybe Text
a -> AddressAttribute
s {$sel:publicIp:AddressAttribute' :: Maybe Text
publicIp = Maybe Text
a} :: AddressAttribute)

instance Data.FromXML AddressAttribute where
  parseXML :: [Node] -> Either String AddressAttribute
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe PtrUpdateStatus
-> Maybe Text
-> AddressAttribute
AddressAttribute'
      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
"allocationId")
      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
"ptrRecord")
      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
"ptrRecordUpdate")
      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
"publicIp")

instance Prelude.Hashable AddressAttribute where
  hashWithSalt :: Int -> AddressAttribute -> Int
hashWithSalt Int
_salt AddressAttribute' {Maybe Text
Maybe PtrUpdateStatus
publicIp :: Maybe Text
ptrRecordUpdate :: Maybe PtrUpdateStatus
ptrRecord :: Maybe Text
allocationId :: Maybe Text
$sel:publicIp:AddressAttribute' :: AddressAttribute -> Maybe Text
$sel:ptrRecordUpdate:AddressAttribute' :: AddressAttribute -> Maybe PtrUpdateStatus
$sel:ptrRecord:AddressAttribute' :: AddressAttribute -> Maybe Text
$sel:allocationId:AddressAttribute' :: AddressAttribute -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
allocationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ptrRecord
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PtrUpdateStatus
ptrRecordUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publicIp

instance Prelude.NFData AddressAttribute where
  rnf :: AddressAttribute -> ()
rnf AddressAttribute' {Maybe Text
Maybe PtrUpdateStatus
publicIp :: Maybe Text
ptrRecordUpdate :: Maybe PtrUpdateStatus
ptrRecord :: Maybe Text
allocationId :: Maybe Text
$sel:publicIp:AddressAttribute' :: AddressAttribute -> Maybe Text
$sel:ptrRecordUpdate:AddressAttribute' :: AddressAttribute -> Maybe PtrUpdateStatus
$sel:ptrRecord:AddressAttribute' :: AddressAttribute -> Maybe Text
$sel:allocationId:AddressAttribute' :: AddressAttribute -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
allocationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ptrRecord
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PtrUpdateStatus
ptrRecordUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publicIp