{-# 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.Route53Resolver.Types.IpAddressUpdate
-- 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.Route53Resolver.Types.IpAddressUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | In an
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_UpdateResolverEndpoint.html UpdateResolverEndpoint>
-- request, information about an IP address to update.
--
-- /See:/ 'newIpAddressUpdate' smart constructor.
data IpAddressUpdate = IpAddressUpdate'
  { -- | The new IP address.
    IpAddressUpdate -> Maybe Text
ip :: Prelude.Maybe Prelude.Text,
    -- | /Only when removing an IP address from a Resolver endpoint/: The ID of
    -- the IP address that you want to remove. To get this ID, use
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_GetResolverEndpoint.html GetResolverEndpoint>.
    IpAddressUpdate -> Maybe Text
ipId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the subnet that includes the IP address that you want to
    -- update. To get this ID, use
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_GetResolverEndpoint.html GetResolverEndpoint>.
    IpAddressUpdate -> Maybe Text
subnetId :: Prelude.Maybe Prelude.Text
  }
  deriving (IpAddressUpdate -> IpAddressUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IpAddressUpdate -> IpAddressUpdate -> Bool
$c/= :: IpAddressUpdate -> IpAddressUpdate -> Bool
== :: IpAddressUpdate -> IpAddressUpdate -> Bool
$c== :: IpAddressUpdate -> IpAddressUpdate -> Bool
Prelude.Eq, ReadPrec [IpAddressUpdate]
ReadPrec IpAddressUpdate
Int -> ReadS IpAddressUpdate
ReadS [IpAddressUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IpAddressUpdate]
$creadListPrec :: ReadPrec [IpAddressUpdate]
readPrec :: ReadPrec IpAddressUpdate
$creadPrec :: ReadPrec IpAddressUpdate
readList :: ReadS [IpAddressUpdate]
$creadList :: ReadS [IpAddressUpdate]
readsPrec :: Int -> ReadS IpAddressUpdate
$creadsPrec :: Int -> ReadS IpAddressUpdate
Prelude.Read, Int -> IpAddressUpdate -> ShowS
[IpAddressUpdate] -> ShowS
IpAddressUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IpAddressUpdate] -> ShowS
$cshowList :: [IpAddressUpdate] -> ShowS
show :: IpAddressUpdate -> String
$cshow :: IpAddressUpdate -> String
showsPrec :: Int -> IpAddressUpdate -> ShowS
$cshowsPrec :: Int -> IpAddressUpdate -> ShowS
Prelude.Show, forall x. Rep IpAddressUpdate x -> IpAddressUpdate
forall x. IpAddressUpdate -> Rep IpAddressUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IpAddressUpdate x -> IpAddressUpdate
$cfrom :: forall x. IpAddressUpdate -> Rep IpAddressUpdate x
Prelude.Generic)

-- |
-- Create a value of 'IpAddressUpdate' 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:
--
-- 'ip', 'ipAddressUpdate_ip' - The new IP address.
--
-- 'ipId', 'ipAddressUpdate_ipId' - /Only when removing an IP address from a Resolver endpoint/: The ID of
-- the IP address that you want to remove. To get this ID, use
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_GetResolverEndpoint.html GetResolverEndpoint>.
--
-- 'subnetId', 'ipAddressUpdate_subnetId' - The ID of the subnet that includes the IP address that you want to
-- update. To get this ID, use
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_GetResolverEndpoint.html GetResolverEndpoint>.
newIpAddressUpdate ::
  IpAddressUpdate
newIpAddressUpdate :: IpAddressUpdate
newIpAddressUpdate =
  IpAddressUpdate'
    { $sel:ip:IpAddressUpdate' :: Maybe Text
ip = forall a. Maybe a
Prelude.Nothing,
      $sel:ipId:IpAddressUpdate' :: Maybe Text
ipId = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetId:IpAddressUpdate' :: Maybe Text
subnetId = forall a. Maybe a
Prelude.Nothing
    }

-- | The new IP address.
ipAddressUpdate_ip :: Lens.Lens' IpAddressUpdate (Prelude.Maybe Prelude.Text)
ipAddressUpdate_ip :: Lens' IpAddressUpdate (Maybe Text)
ipAddressUpdate_ip = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressUpdate' {Maybe Text
ip :: Maybe Text
$sel:ip:IpAddressUpdate' :: IpAddressUpdate -> Maybe Text
ip} -> Maybe Text
ip) (\s :: IpAddressUpdate
s@IpAddressUpdate' {} Maybe Text
a -> IpAddressUpdate
s {$sel:ip:IpAddressUpdate' :: Maybe Text
ip = Maybe Text
a} :: IpAddressUpdate)

-- | /Only when removing an IP address from a Resolver endpoint/: The ID of
-- the IP address that you want to remove. To get this ID, use
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_GetResolverEndpoint.html GetResolverEndpoint>.
ipAddressUpdate_ipId :: Lens.Lens' IpAddressUpdate (Prelude.Maybe Prelude.Text)
ipAddressUpdate_ipId :: Lens' IpAddressUpdate (Maybe Text)
ipAddressUpdate_ipId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressUpdate' {Maybe Text
ipId :: Maybe Text
$sel:ipId:IpAddressUpdate' :: IpAddressUpdate -> Maybe Text
ipId} -> Maybe Text
ipId) (\s :: IpAddressUpdate
s@IpAddressUpdate' {} Maybe Text
a -> IpAddressUpdate
s {$sel:ipId:IpAddressUpdate' :: Maybe Text
ipId = Maybe Text
a} :: IpAddressUpdate)

-- | The ID of the subnet that includes the IP address that you want to
-- update. To get this ID, use
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_GetResolverEndpoint.html GetResolverEndpoint>.
ipAddressUpdate_subnetId :: Lens.Lens' IpAddressUpdate (Prelude.Maybe Prelude.Text)
ipAddressUpdate_subnetId :: Lens' IpAddressUpdate (Maybe Text)
ipAddressUpdate_subnetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressUpdate' {Maybe Text
subnetId :: Maybe Text
$sel:subnetId:IpAddressUpdate' :: IpAddressUpdate -> Maybe Text
subnetId} -> Maybe Text
subnetId) (\s :: IpAddressUpdate
s@IpAddressUpdate' {} Maybe Text
a -> IpAddressUpdate
s {$sel:subnetId:IpAddressUpdate' :: Maybe Text
subnetId = Maybe Text
a} :: IpAddressUpdate)

instance Prelude.Hashable IpAddressUpdate where
  hashWithSalt :: Int -> IpAddressUpdate -> Int
hashWithSalt Int
_salt IpAddressUpdate' {Maybe Text
subnetId :: Maybe Text
ipId :: Maybe Text
ip :: Maybe Text
$sel:subnetId:IpAddressUpdate' :: IpAddressUpdate -> Maybe Text
$sel:ipId:IpAddressUpdate' :: IpAddressUpdate -> Maybe Text
$sel:ip:IpAddressUpdate' :: IpAddressUpdate -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ip
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subnetId

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

instance Data.ToJSON IpAddressUpdate where
  toJSON :: IpAddressUpdate -> Value
toJSON IpAddressUpdate' {Maybe Text
subnetId :: Maybe Text
ipId :: Maybe Text
ip :: Maybe Text
$sel:subnetId:IpAddressUpdate' :: IpAddressUpdate -> Maybe Text
$sel:ipId:IpAddressUpdate' :: IpAddressUpdate -> Maybe Text
$sel:ip:IpAddressUpdate' :: IpAddressUpdate -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Ip" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ip,
            (Key
"IpId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ipId,
            (Key
"SubnetId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
subnetId
          ]
      )