{-# 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.IpAddressResponse
-- 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.IpAddressResponse where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53Resolver.Types.IpAddressStatus

-- | In the response to a
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_GetResolverEndpoint.html GetResolverEndpoint>
-- request, information about the IP addresses that the Resolver endpoint
-- uses for DNS queries.
--
-- /See:/ 'newIpAddressResponse' smart constructor.
data IpAddressResponse = IpAddressResponse'
  { -- | The date and time that the IP address was created, in Unix time format
    -- and Coordinated Universal Time (UTC).
    IpAddressResponse -> Maybe Text
creationTime :: Prelude.Maybe Prelude.Text,
    -- | A status code that gives the current status of the request.
    IpAddressResponse -> Maybe IpAddressStatus
status :: Prelude.Maybe IpAddressStatus,
    -- | The date and time that the IP address was last modified, in Unix time
    -- format and Coordinated Universal Time (UTC).
    IpAddressResponse -> Maybe Text
modificationTime :: Prelude.Maybe Prelude.Text,
    -- | The ID of one subnet.
    IpAddressResponse -> Maybe Text
subnetId :: Prelude.Maybe Prelude.Text,
    -- | One IP address that the Resolver endpoint uses for DNS queries.
    IpAddressResponse -> Maybe Text
ip :: Prelude.Maybe Prelude.Text,
    -- | The ID of one IP address.
    IpAddressResponse -> Maybe Text
ipId :: Prelude.Maybe Prelude.Text,
    -- | A message that provides additional information about the status of the
    -- request.
    IpAddressResponse -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (IpAddressResponse -> IpAddressResponse -> Bool
(IpAddressResponse -> IpAddressResponse -> Bool)
-> (IpAddressResponse -> IpAddressResponse -> Bool)
-> Eq IpAddressResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IpAddressResponse -> IpAddressResponse -> Bool
$c/= :: IpAddressResponse -> IpAddressResponse -> Bool
== :: IpAddressResponse -> IpAddressResponse -> Bool
$c== :: IpAddressResponse -> IpAddressResponse -> Bool
Prelude.Eq, ReadPrec [IpAddressResponse]
ReadPrec IpAddressResponse
Int -> ReadS IpAddressResponse
ReadS [IpAddressResponse]
(Int -> ReadS IpAddressResponse)
-> ReadS [IpAddressResponse]
-> ReadPrec IpAddressResponse
-> ReadPrec [IpAddressResponse]
-> Read IpAddressResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IpAddressResponse]
$creadListPrec :: ReadPrec [IpAddressResponse]
readPrec :: ReadPrec IpAddressResponse
$creadPrec :: ReadPrec IpAddressResponse
readList :: ReadS [IpAddressResponse]
$creadList :: ReadS [IpAddressResponse]
readsPrec :: Int -> ReadS IpAddressResponse
$creadsPrec :: Int -> ReadS IpAddressResponse
Prelude.Read, Int -> IpAddressResponse -> ShowS
[IpAddressResponse] -> ShowS
IpAddressResponse -> String
(Int -> IpAddressResponse -> ShowS)
-> (IpAddressResponse -> String)
-> ([IpAddressResponse] -> ShowS)
-> Show IpAddressResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IpAddressResponse] -> ShowS
$cshowList :: [IpAddressResponse] -> ShowS
show :: IpAddressResponse -> String
$cshow :: IpAddressResponse -> String
showsPrec :: Int -> IpAddressResponse -> ShowS
$cshowsPrec :: Int -> IpAddressResponse -> ShowS
Prelude.Show, (forall x. IpAddressResponse -> Rep IpAddressResponse x)
-> (forall x. Rep IpAddressResponse x -> IpAddressResponse)
-> Generic IpAddressResponse
forall x. Rep IpAddressResponse x -> IpAddressResponse
forall x. IpAddressResponse -> Rep IpAddressResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IpAddressResponse x -> IpAddressResponse
$cfrom :: forall x. IpAddressResponse -> Rep IpAddressResponse x
Prelude.Generic)

-- |
-- Create a value of 'IpAddressResponse' 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:
--
-- 'creationTime', 'ipAddressResponse_creationTime' - The date and time that the IP address was created, in Unix time format
-- and Coordinated Universal Time (UTC).
--
-- 'status', 'ipAddressResponse_status' - A status code that gives the current status of the request.
--
-- 'modificationTime', 'ipAddressResponse_modificationTime' - The date and time that the IP address was last modified, in Unix time
-- format and Coordinated Universal Time (UTC).
--
-- 'subnetId', 'ipAddressResponse_subnetId' - The ID of one subnet.
--
-- 'ip', 'ipAddressResponse_ip' - One IP address that the Resolver endpoint uses for DNS queries.
--
-- 'ipId', 'ipAddressResponse_ipId' - The ID of one IP address.
--
-- 'statusMessage', 'ipAddressResponse_statusMessage' - A message that provides additional information about the status of the
-- request.
newIpAddressResponse ::
  IpAddressResponse
newIpAddressResponse :: IpAddressResponse
newIpAddressResponse =
  IpAddressResponse' :: Maybe Text
-> Maybe IpAddressStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> IpAddressResponse
IpAddressResponse'
    { $sel:creationTime:IpAddressResponse' :: Maybe Text
creationTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:IpAddressResponse' :: Maybe IpAddressStatus
status = Maybe IpAddressStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:modificationTime:IpAddressResponse' :: Maybe Text
modificationTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetId:IpAddressResponse' :: Maybe Text
subnetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ip:IpAddressResponse' :: Maybe Text
ip = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipId:IpAddressResponse' :: Maybe Text
ipId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:IpAddressResponse' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time that the IP address was created, in Unix time format
-- and Coordinated Universal Time (UTC).
ipAddressResponse_creationTime :: Lens.Lens' IpAddressResponse (Prelude.Maybe Prelude.Text)
ipAddressResponse_creationTime :: (Maybe Text -> f (Maybe Text))
-> IpAddressResponse -> f IpAddressResponse
ipAddressResponse_creationTime = (IpAddressResponse -> Maybe Text)
-> (IpAddressResponse -> Maybe Text -> IpAddressResponse)
-> Lens
     IpAddressResponse IpAddressResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressResponse' {Maybe Text
creationTime :: Maybe Text
$sel:creationTime:IpAddressResponse' :: IpAddressResponse -> Maybe Text
creationTime} -> Maybe Text
creationTime) (\s :: IpAddressResponse
s@IpAddressResponse' {} Maybe Text
a -> IpAddressResponse
s {$sel:creationTime:IpAddressResponse' :: Maybe Text
creationTime = Maybe Text
a} :: IpAddressResponse)

-- | A status code that gives the current status of the request.
ipAddressResponse_status :: Lens.Lens' IpAddressResponse (Prelude.Maybe IpAddressStatus)
ipAddressResponse_status :: (Maybe IpAddressStatus -> f (Maybe IpAddressStatus))
-> IpAddressResponse -> f IpAddressResponse
ipAddressResponse_status = (IpAddressResponse -> Maybe IpAddressStatus)
-> (IpAddressResponse
    -> Maybe IpAddressStatus -> IpAddressResponse)
-> Lens
     IpAddressResponse
     IpAddressResponse
     (Maybe IpAddressStatus)
     (Maybe IpAddressStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressResponse' {Maybe IpAddressStatus
status :: Maybe IpAddressStatus
$sel:status:IpAddressResponse' :: IpAddressResponse -> Maybe IpAddressStatus
status} -> Maybe IpAddressStatus
status) (\s :: IpAddressResponse
s@IpAddressResponse' {} Maybe IpAddressStatus
a -> IpAddressResponse
s {$sel:status:IpAddressResponse' :: Maybe IpAddressStatus
status = Maybe IpAddressStatus
a} :: IpAddressResponse)

-- | The date and time that the IP address was last modified, in Unix time
-- format and Coordinated Universal Time (UTC).
ipAddressResponse_modificationTime :: Lens.Lens' IpAddressResponse (Prelude.Maybe Prelude.Text)
ipAddressResponse_modificationTime :: (Maybe Text -> f (Maybe Text))
-> IpAddressResponse -> f IpAddressResponse
ipAddressResponse_modificationTime = (IpAddressResponse -> Maybe Text)
-> (IpAddressResponse -> Maybe Text -> IpAddressResponse)
-> Lens
     IpAddressResponse IpAddressResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressResponse' {Maybe Text
modificationTime :: Maybe Text
$sel:modificationTime:IpAddressResponse' :: IpAddressResponse -> Maybe Text
modificationTime} -> Maybe Text
modificationTime) (\s :: IpAddressResponse
s@IpAddressResponse' {} Maybe Text
a -> IpAddressResponse
s {$sel:modificationTime:IpAddressResponse' :: Maybe Text
modificationTime = Maybe Text
a} :: IpAddressResponse)

-- | The ID of one subnet.
ipAddressResponse_subnetId :: Lens.Lens' IpAddressResponse (Prelude.Maybe Prelude.Text)
ipAddressResponse_subnetId :: (Maybe Text -> f (Maybe Text))
-> IpAddressResponse -> f IpAddressResponse
ipAddressResponse_subnetId = (IpAddressResponse -> Maybe Text)
-> (IpAddressResponse -> Maybe Text -> IpAddressResponse)
-> Lens
     IpAddressResponse IpAddressResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressResponse' {Maybe Text
subnetId :: Maybe Text
$sel:subnetId:IpAddressResponse' :: IpAddressResponse -> Maybe Text
subnetId} -> Maybe Text
subnetId) (\s :: IpAddressResponse
s@IpAddressResponse' {} Maybe Text
a -> IpAddressResponse
s {$sel:subnetId:IpAddressResponse' :: Maybe Text
subnetId = Maybe Text
a} :: IpAddressResponse)

-- | One IP address that the Resolver endpoint uses for DNS queries.
ipAddressResponse_ip :: Lens.Lens' IpAddressResponse (Prelude.Maybe Prelude.Text)
ipAddressResponse_ip :: (Maybe Text -> f (Maybe Text))
-> IpAddressResponse -> f IpAddressResponse
ipAddressResponse_ip = (IpAddressResponse -> Maybe Text)
-> (IpAddressResponse -> Maybe Text -> IpAddressResponse)
-> Lens
     IpAddressResponse IpAddressResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressResponse' {Maybe Text
ip :: Maybe Text
$sel:ip:IpAddressResponse' :: IpAddressResponse -> Maybe Text
ip} -> Maybe Text
ip) (\s :: IpAddressResponse
s@IpAddressResponse' {} Maybe Text
a -> IpAddressResponse
s {$sel:ip:IpAddressResponse' :: Maybe Text
ip = Maybe Text
a} :: IpAddressResponse)

-- | The ID of one IP address.
ipAddressResponse_ipId :: Lens.Lens' IpAddressResponse (Prelude.Maybe Prelude.Text)
ipAddressResponse_ipId :: (Maybe Text -> f (Maybe Text))
-> IpAddressResponse -> f IpAddressResponse
ipAddressResponse_ipId = (IpAddressResponse -> Maybe Text)
-> (IpAddressResponse -> Maybe Text -> IpAddressResponse)
-> Lens
     IpAddressResponse IpAddressResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressResponse' {Maybe Text
ipId :: Maybe Text
$sel:ipId:IpAddressResponse' :: IpAddressResponse -> Maybe Text
ipId} -> Maybe Text
ipId) (\s :: IpAddressResponse
s@IpAddressResponse' {} Maybe Text
a -> IpAddressResponse
s {$sel:ipId:IpAddressResponse' :: Maybe Text
ipId = Maybe Text
a} :: IpAddressResponse)

-- | A message that provides additional information about the status of the
-- request.
ipAddressResponse_statusMessage :: Lens.Lens' IpAddressResponse (Prelude.Maybe Prelude.Text)
ipAddressResponse_statusMessage :: (Maybe Text -> f (Maybe Text))
-> IpAddressResponse -> f IpAddressResponse
ipAddressResponse_statusMessage = (IpAddressResponse -> Maybe Text)
-> (IpAddressResponse -> Maybe Text -> IpAddressResponse)
-> Lens
     IpAddressResponse IpAddressResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpAddressResponse' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:IpAddressResponse' :: IpAddressResponse -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: IpAddressResponse
s@IpAddressResponse' {} Maybe Text
a -> IpAddressResponse
s {$sel:statusMessage:IpAddressResponse' :: Maybe Text
statusMessage = Maybe Text
a} :: IpAddressResponse)

instance Core.FromJSON IpAddressResponse where
  parseJSON :: Value -> Parser IpAddressResponse
parseJSON =
    String
-> (Object -> Parser IpAddressResponse)
-> Value
-> Parser IpAddressResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IpAddressResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe IpAddressStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> IpAddressResponse
IpAddressResponse'
            (Maybe Text
 -> Maybe IpAddressStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> IpAddressResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe IpAddressStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> IpAddressResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
            Parser
  (Maybe IpAddressStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> IpAddressResponse)
-> Parser (Maybe IpAddressStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> IpAddressResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IpAddressStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> IpAddressResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> IpAddressResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ModificationTime")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> IpAddressResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> IpAddressResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubnetId")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> IpAddressResponse)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> IpAddressResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Ip")
            Parser (Maybe Text -> Maybe Text -> IpAddressResponse)
-> Parser (Maybe Text) -> Parser (Maybe Text -> IpAddressResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IpId")
            Parser (Maybe Text -> IpAddressResponse)
-> Parser (Maybe Text) -> Parser IpAddressResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusMessage")
      )

instance Prelude.Hashable IpAddressResponse

instance Prelude.NFData IpAddressResponse