{-# 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.DirectoryService.Types.IpRouteInfo
-- 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.DirectoryService.Types.IpRouteInfo where

import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.Types.IpRouteStatusMsg
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about one or more IP address blocks.
--
-- /See:/ 'newIpRouteInfo' smart constructor.
data IpRouteInfo = IpRouteInfo'
  { -- | Identifier (ID) of the directory associated with the IP addresses.
    IpRouteInfo -> Maybe Text
directoryId :: Prelude.Maybe Prelude.Text,
    -- | The reason for the IpRouteStatusMsg.
    IpRouteInfo -> Maybe Text
ipRouteStatusReason :: Prelude.Maybe Prelude.Text,
    -- | The date and time the address block was added to the directory.
    IpRouteInfo -> Maybe POSIX
addedDateTime :: Prelude.Maybe Core.POSIX,
    -- | IP address block in the IpRoute.
    IpRouteInfo -> Maybe Text
cidrIp :: Prelude.Maybe Prelude.Text,
    -- | The status of the IP address block.
    IpRouteInfo -> Maybe IpRouteStatusMsg
ipRouteStatusMsg :: Prelude.Maybe IpRouteStatusMsg,
    -- | Description of the IpRouteInfo.
    IpRouteInfo -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (IpRouteInfo -> IpRouteInfo -> Bool
(IpRouteInfo -> IpRouteInfo -> Bool)
-> (IpRouteInfo -> IpRouteInfo -> Bool) -> Eq IpRouteInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IpRouteInfo -> IpRouteInfo -> Bool
$c/= :: IpRouteInfo -> IpRouteInfo -> Bool
== :: IpRouteInfo -> IpRouteInfo -> Bool
$c== :: IpRouteInfo -> IpRouteInfo -> Bool
Prelude.Eq, ReadPrec [IpRouteInfo]
ReadPrec IpRouteInfo
Int -> ReadS IpRouteInfo
ReadS [IpRouteInfo]
(Int -> ReadS IpRouteInfo)
-> ReadS [IpRouteInfo]
-> ReadPrec IpRouteInfo
-> ReadPrec [IpRouteInfo]
-> Read IpRouteInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IpRouteInfo]
$creadListPrec :: ReadPrec [IpRouteInfo]
readPrec :: ReadPrec IpRouteInfo
$creadPrec :: ReadPrec IpRouteInfo
readList :: ReadS [IpRouteInfo]
$creadList :: ReadS [IpRouteInfo]
readsPrec :: Int -> ReadS IpRouteInfo
$creadsPrec :: Int -> ReadS IpRouteInfo
Prelude.Read, Int -> IpRouteInfo -> ShowS
[IpRouteInfo] -> ShowS
IpRouteInfo -> String
(Int -> IpRouteInfo -> ShowS)
-> (IpRouteInfo -> String)
-> ([IpRouteInfo] -> ShowS)
-> Show IpRouteInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IpRouteInfo] -> ShowS
$cshowList :: [IpRouteInfo] -> ShowS
show :: IpRouteInfo -> String
$cshow :: IpRouteInfo -> String
showsPrec :: Int -> IpRouteInfo -> ShowS
$cshowsPrec :: Int -> IpRouteInfo -> ShowS
Prelude.Show, (forall x. IpRouteInfo -> Rep IpRouteInfo x)
-> (forall x. Rep IpRouteInfo x -> IpRouteInfo)
-> Generic IpRouteInfo
forall x. Rep IpRouteInfo x -> IpRouteInfo
forall x. IpRouteInfo -> Rep IpRouteInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IpRouteInfo x -> IpRouteInfo
$cfrom :: forall x. IpRouteInfo -> Rep IpRouteInfo x
Prelude.Generic)

-- |
-- Create a value of 'IpRouteInfo' 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:
--
-- 'directoryId', 'ipRouteInfo_directoryId' - Identifier (ID) of the directory associated with the IP addresses.
--
-- 'ipRouteStatusReason', 'ipRouteInfo_ipRouteStatusReason' - The reason for the IpRouteStatusMsg.
--
-- 'addedDateTime', 'ipRouteInfo_addedDateTime' - The date and time the address block was added to the directory.
--
-- 'cidrIp', 'ipRouteInfo_cidrIp' - IP address block in the IpRoute.
--
-- 'ipRouteStatusMsg', 'ipRouteInfo_ipRouteStatusMsg' - The status of the IP address block.
--
-- 'description', 'ipRouteInfo_description' - Description of the IpRouteInfo.
newIpRouteInfo ::
  IpRouteInfo
newIpRouteInfo :: IpRouteInfo
newIpRouteInfo =
  IpRouteInfo' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe IpRouteStatusMsg
-> Maybe Text
-> IpRouteInfo
IpRouteInfo'
    { $sel:directoryId:IpRouteInfo' :: Maybe Text
directoryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipRouteStatusReason:IpRouteInfo' :: Maybe Text
ipRouteStatusReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:addedDateTime:IpRouteInfo' :: Maybe POSIX
addedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:cidrIp:IpRouteInfo' :: Maybe Text
cidrIp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipRouteStatusMsg:IpRouteInfo' :: Maybe IpRouteStatusMsg
ipRouteStatusMsg = Maybe IpRouteStatusMsg
forall a. Maybe a
Prelude.Nothing,
      $sel:description:IpRouteInfo' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Identifier (ID) of the directory associated with the IP addresses.
ipRouteInfo_directoryId :: Lens.Lens' IpRouteInfo (Prelude.Maybe Prelude.Text)
ipRouteInfo_directoryId :: (Maybe Text -> f (Maybe Text)) -> IpRouteInfo -> f IpRouteInfo
ipRouteInfo_directoryId = (IpRouteInfo -> Maybe Text)
-> (IpRouteInfo -> Maybe Text -> IpRouteInfo)
-> Lens IpRouteInfo IpRouteInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpRouteInfo' {Maybe Text
directoryId :: Maybe Text
$sel:directoryId:IpRouteInfo' :: IpRouteInfo -> Maybe Text
directoryId} -> Maybe Text
directoryId) (\s :: IpRouteInfo
s@IpRouteInfo' {} Maybe Text
a -> IpRouteInfo
s {$sel:directoryId:IpRouteInfo' :: Maybe Text
directoryId = Maybe Text
a} :: IpRouteInfo)

-- | The reason for the IpRouteStatusMsg.
ipRouteInfo_ipRouteStatusReason :: Lens.Lens' IpRouteInfo (Prelude.Maybe Prelude.Text)
ipRouteInfo_ipRouteStatusReason :: (Maybe Text -> f (Maybe Text)) -> IpRouteInfo -> f IpRouteInfo
ipRouteInfo_ipRouteStatusReason = (IpRouteInfo -> Maybe Text)
-> (IpRouteInfo -> Maybe Text -> IpRouteInfo)
-> Lens IpRouteInfo IpRouteInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpRouteInfo' {Maybe Text
ipRouteStatusReason :: Maybe Text
$sel:ipRouteStatusReason:IpRouteInfo' :: IpRouteInfo -> Maybe Text
ipRouteStatusReason} -> Maybe Text
ipRouteStatusReason) (\s :: IpRouteInfo
s@IpRouteInfo' {} Maybe Text
a -> IpRouteInfo
s {$sel:ipRouteStatusReason:IpRouteInfo' :: Maybe Text
ipRouteStatusReason = Maybe Text
a} :: IpRouteInfo)

-- | The date and time the address block was added to the directory.
ipRouteInfo_addedDateTime :: Lens.Lens' IpRouteInfo (Prelude.Maybe Prelude.UTCTime)
ipRouteInfo_addedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> IpRouteInfo -> f IpRouteInfo
ipRouteInfo_addedDateTime = (IpRouteInfo -> Maybe POSIX)
-> (IpRouteInfo -> Maybe POSIX -> IpRouteInfo)
-> Lens IpRouteInfo IpRouteInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpRouteInfo' {Maybe POSIX
addedDateTime :: Maybe POSIX
$sel:addedDateTime:IpRouteInfo' :: IpRouteInfo -> Maybe POSIX
addedDateTime} -> Maybe POSIX
addedDateTime) (\s :: IpRouteInfo
s@IpRouteInfo' {} Maybe POSIX
a -> IpRouteInfo
s {$sel:addedDateTime:IpRouteInfo' :: Maybe POSIX
addedDateTime = Maybe POSIX
a} :: IpRouteInfo) ((Maybe POSIX -> f (Maybe POSIX)) -> IpRouteInfo -> f IpRouteInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> IpRouteInfo
-> f IpRouteInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | IP address block in the IpRoute.
ipRouteInfo_cidrIp :: Lens.Lens' IpRouteInfo (Prelude.Maybe Prelude.Text)
ipRouteInfo_cidrIp :: (Maybe Text -> f (Maybe Text)) -> IpRouteInfo -> f IpRouteInfo
ipRouteInfo_cidrIp = (IpRouteInfo -> Maybe Text)
-> (IpRouteInfo -> Maybe Text -> IpRouteInfo)
-> Lens IpRouteInfo IpRouteInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpRouteInfo' {Maybe Text
cidrIp :: Maybe Text
$sel:cidrIp:IpRouteInfo' :: IpRouteInfo -> Maybe Text
cidrIp} -> Maybe Text
cidrIp) (\s :: IpRouteInfo
s@IpRouteInfo' {} Maybe Text
a -> IpRouteInfo
s {$sel:cidrIp:IpRouteInfo' :: Maybe Text
cidrIp = Maybe Text
a} :: IpRouteInfo)

-- | The status of the IP address block.
ipRouteInfo_ipRouteStatusMsg :: Lens.Lens' IpRouteInfo (Prelude.Maybe IpRouteStatusMsg)
ipRouteInfo_ipRouteStatusMsg :: (Maybe IpRouteStatusMsg -> f (Maybe IpRouteStatusMsg))
-> IpRouteInfo -> f IpRouteInfo
ipRouteInfo_ipRouteStatusMsg = (IpRouteInfo -> Maybe IpRouteStatusMsg)
-> (IpRouteInfo -> Maybe IpRouteStatusMsg -> IpRouteInfo)
-> Lens
     IpRouteInfo
     IpRouteInfo
     (Maybe IpRouteStatusMsg)
     (Maybe IpRouteStatusMsg)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpRouteInfo' {Maybe IpRouteStatusMsg
ipRouteStatusMsg :: Maybe IpRouteStatusMsg
$sel:ipRouteStatusMsg:IpRouteInfo' :: IpRouteInfo -> Maybe IpRouteStatusMsg
ipRouteStatusMsg} -> Maybe IpRouteStatusMsg
ipRouteStatusMsg) (\s :: IpRouteInfo
s@IpRouteInfo' {} Maybe IpRouteStatusMsg
a -> IpRouteInfo
s {$sel:ipRouteStatusMsg:IpRouteInfo' :: Maybe IpRouteStatusMsg
ipRouteStatusMsg = Maybe IpRouteStatusMsg
a} :: IpRouteInfo)

-- | Description of the IpRouteInfo.
ipRouteInfo_description :: Lens.Lens' IpRouteInfo (Prelude.Maybe Prelude.Text)
ipRouteInfo_description :: (Maybe Text -> f (Maybe Text)) -> IpRouteInfo -> f IpRouteInfo
ipRouteInfo_description = (IpRouteInfo -> Maybe Text)
-> (IpRouteInfo -> Maybe Text -> IpRouteInfo)
-> Lens IpRouteInfo IpRouteInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpRouteInfo' {Maybe Text
description :: Maybe Text
$sel:description:IpRouteInfo' :: IpRouteInfo -> Maybe Text
description} -> Maybe Text
description) (\s :: IpRouteInfo
s@IpRouteInfo' {} Maybe Text
a -> IpRouteInfo
s {$sel:description:IpRouteInfo' :: Maybe Text
description = Maybe Text
a} :: IpRouteInfo)

instance Core.FromJSON IpRouteInfo where
  parseJSON :: Value -> Parser IpRouteInfo
parseJSON =
    String
-> (Object -> Parser IpRouteInfo) -> Value -> Parser IpRouteInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IpRouteInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe IpRouteStatusMsg
-> Maybe Text
-> IpRouteInfo
IpRouteInfo'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe IpRouteStatusMsg
 -> Maybe Text
 -> IpRouteInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe IpRouteStatusMsg
      -> Maybe Text
      -> IpRouteInfo)
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
"DirectoryId")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe IpRouteStatusMsg
   -> Maybe Text
   -> IpRouteInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe IpRouteStatusMsg
      -> Maybe Text
      -> IpRouteInfo)
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
"IpRouteStatusReason")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe IpRouteStatusMsg
   -> Maybe Text
   -> IpRouteInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe IpRouteStatusMsg -> Maybe Text -> IpRouteInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AddedDateTime")
            Parser
  (Maybe Text -> Maybe IpRouteStatusMsg -> Maybe Text -> IpRouteInfo)
-> Parser (Maybe Text)
-> Parser (Maybe IpRouteStatusMsg -> Maybe Text -> IpRouteInfo)
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
"CidrIp")
            Parser (Maybe IpRouteStatusMsg -> Maybe Text -> IpRouteInfo)
-> Parser (Maybe IpRouteStatusMsg)
-> Parser (Maybe Text -> IpRouteInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IpRouteStatusMsg)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IpRouteStatusMsg")
            Parser (Maybe Text -> IpRouteInfo)
-> Parser (Maybe Text) -> Parser IpRouteInfo
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
"Description")
      )

instance Prelude.Hashable IpRouteInfo

instance Prelude.NFData IpRouteInfo