{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53Resolver.Types.IpAddressUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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
  }
  deriving (IpAddressUpdate -> IpAddressUpdate -> Bool
(IpAddressUpdate -> IpAddressUpdate -> Bool)
-> (IpAddressUpdate -> IpAddressUpdate -> Bool)
-> Eq IpAddressUpdate
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]
(Int -> ReadS IpAddressUpdate)
-> ReadS [IpAddressUpdate]
-> ReadPrec IpAddressUpdate
-> ReadPrec [IpAddressUpdate]
-> Read 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
(Int -> IpAddressUpdate -> ShowS)
-> (IpAddressUpdate -> String)
-> ([IpAddressUpdate] -> ShowS)
-> Show IpAddressUpdate
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. IpAddressUpdate -> Rep IpAddressUpdate x)
-> (forall x. Rep IpAddressUpdate x -> IpAddressUpdate)
-> Generic IpAddressUpdate
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:
--
-- '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>.
--
-- '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>.
newIpAddressUpdate ::
  IpAddressUpdate
newIpAddressUpdate :: IpAddressUpdate
newIpAddressUpdate =
  IpAddressUpdate' :: Maybe Text -> Maybe Text -> Maybe Text -> IpAddressUpdate
IpAddressUpdate'
    { $sel:subnetId:IpAddressUpdate' :: Maybe Text
subnetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ip:IpAddressUpdate' :: Maybe Text
ip = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipId:IpAddressUpdate' :: Maybe Text
ipId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> IpAddressUpdate -> f IpAddressUpdate
ipAddressUpdate_subnetId = (IpAddressUpdate -> Maybe Text)
-> (IpAddressUpdate -> Maybe Text -> IpAddressUpdate)
-> Lens IpAddressUpdate IpAddressUpdate (Maybe Text) (Maybe Text)
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)

-- | The new IP address.
ipAddressUpdate_ip :: Lens.Lens' IpAddressUpdate (Prelude.Maybe Prelude.Text)
ipAddressUpdate_ip :: (Maybe Text -> f (Maybe Text))
-> IpAddressUpdate -> f IpAddressUpdate
ipAddressUpdate_ip = (IpAddressUpdate -> Maybe Text)
-> (IpAddressUpdate -> Maybe Text -> IpAddressUpdate)
-> Lens IpAddressUpdate IpAddressUpdate (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> IpAddressUpdate -> f IpAddressUpdate
ipAddressUpdate_ipId = (IpAddressUpdate -> Maybe Text)
-> (IpAddressUpdate -> Maybe Text -> IpAddressUpdate)
-> Lens IpAddressUpdate IpAddressUpdate (Maybe Text) (Maybe Text)
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)

instance Prelude.Hashable IpAddressUpdate

instance Prelude.NFData IpAddressUpdate

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