{-# 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.GlobalAccelerator.Types.ByoipCidrEvent
-- 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.GlobalAccelerator.Types.ByoipCidrEvent where

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

-- | A complex type that contains a @Message@ and a @Timestamp@ value for
-- changes that you make in the status an IP address range that you bring
-- to AWS Global Accelerator through bring your own IP address (BYOIP).
--
-- /See:/ 'newByoipCidrEvent' smart constructor.
data ByoipCidrEvent = ByoipCidrEvent'
  { -- | A string that contains an @Event@ message describing changes that you
    -- make in the status of an IP address range that you bring to AWS Global
    -- Accelerator through bring your own IP address (BYOIP).
    ByoipCidrEvent -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | A timestamp when you make a status change for an IP address range that
    -- you bring to AWS Global Accelerator through bring your own IP address
    -- (BYOIP).
    ByoipCidrEvent -> Maybe POSIX
timestamp :: Prelude.Maybe Core.POSIX
  }
  deriving (ByoipCidrEvent -> ByoipCidrEvent -> Bool
(ByoipCidrEvent -> ByoipCidrEvent -> Bool)
-> (ByoipCidrEvent -> ByoipCidrEvent -> Bool) -> Eq ByoipCidrEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ByoipCidrEvent -> ByoipCidrEvent -> Bool
$c/= :: ByoipCidrEvent -> ByoipCidrEvent -> Bool
== :: ByoipCidrEvent -> ByoipCidrEvent -> Bool
$c== :: ByoipCidrEvent -> ByoipCidrEvent -> Bool
Prelude.Eq, ReadPrec [ByoipCidrEvent]
ReadPrec ByoipCidrEvent
Int -> ReadS ByoipCidrEvent
ReadS [ByoipCidrEvent]
(Int -> ReadS ByoipCidrEvent)
-> ReadS [ByoipCidrEvent]
-> ReadPrec ByoipCidrEvent
-> ReadPrec [ByoipCidrEvent]
-> Read ByoipCidrEvent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ByoipCidrEvent]
$creadListPrec :: ReadPrec [ByoipCidrEvent]
readPrec :: ReadPrec ByoipCidrEvent
$creadPrec :: ReadPrec ByoipCidrEvent
readList :: ReadS [ByoipCidrEvent]
$creadList :: ReadS [ByoipCidrEvent]
readsPrec :: Int -> ReadS ByoipCidrEvent
$creadsPrec :: Int -> ReadS ByoipCidrEvent
Prelude.Read, Int -> ByoipCidrEvent -> ShowS
[ByoipCidrEvent] -> ShowS
ByoipCidrEvent -> String
(Int -> ByoipCidrEvent -> ShowS)
-> (ByoipCidrEvent -> String)
-> ([ByoipCidrEvent] -> ShowS)
-> Show ByoipCidrEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ByoipCidrEvent] -> ShowS
$cshowList :: [ByoipCidrEvent] -> ShowS
show :: ByoipCidrEvent -> String
$cshow :: ByoipCidrEvent -> String
showsPrec :: Int -> ByoipCidrEvent -> ShowS
$cshowsPrec :: Int -> ByoipCidrEvent -> ShowS
Prelude.Show, (forall x. ByoipCidrEvent -> Rep ByoipCidrEvent x)
-> (forall x. Rep ByoipCidrEvent x -> ByoipCidrEvent)
-> Generic ByoipCidrEvent
forall x. Rep ByoipCidrEvent x -> ByoipCidrEvent
forall x. ByoipCidrEvent -> Rep ByoipCidrEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ByoipCidrEvent x -> ByoipCidrEvent
$cfrom :: forall x. ByoipCidrEvent -> Rep ByoipCidrEvent x
Prelude.Generic)

-- |
-- Create a value of 'ByoipCidrEvent' 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:
--
-- 'message', 'byoipCidrEvent_message' - A string that contains an @Event@ message describing changes that you
-- make in the status of an IP address range that you bring to AWS Global
-- Accelerator through bring your own IP address (BYOIP).
--
-- 'timestamp', 'byoipCidrEvent_timestamp' - A timestamp when you make a status change for an IP address range that
-- you bring to AWS Global Accelerator through bring your own IP address
-- (BYOIP).
newByoipCidrEvent ::
  ByoipCidrEvent
newByoipCidrEvent :: ByoipCidrEvent
newByoipCidrEvent =
  ByoipCidrEvent' :: Maybe Text -> Maybe POSIX -> ByoipCidrEvent
ByoipCidrEvent'
    { $sel:message:ByoipCidrEvent' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:ByoipCidrEvent' :: Maybe POSIX
timestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | A string that contains an @Event@ message describing changes that you
-- make in the status of an IP address range that you bring to AWS Global
-- Accelerator through bring your own IP address (BYOIP).
byoipCidrEvent_message :: Lens.Lens' ByoipCidrEvent (Prelude.Maybe Prelude.Text)
byoipCidrEvent_message :: (Maybe Text -> f (Maybe Text))
-> ByoipCidrEvent -> f ByoipCidrEvent
byoipCidrEvent_message = (ByoipCidrEvent -> Maybe Text)
-> (ByoipCidrEvent -> Maybe Text -> ByoipCidrEvent)
-> Lens ByoipCidrEvent ByoipCidrEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ByoipCidrEvent' {Maybe Text
message :: Maybe Text
$sel:message:ByoipCidrEvent' :: ByoipCidrEvent -> Maybe Text
message} -> Maybe Text
message) (\s :: ByoipCidrEvent
s@ByoipCidrEvent' {} Maybe Text
a -> ByoipCidrEvent
s {$sel:message:ByoipCidrEvent' :: Maybe Text
message = Maybe Text
a} :: ByoipCidrEvent)

-- | A timestamp when you make a status change for an IP address range that
-- you bring to AWS Global Accelerator through bring your own IP address
-- (BYOIP).
byoipCidrEvent_timestamp :: Lens.Lens' ByoipCidrEvent (Prelude.Maybe Prelude.UTCTime)
byoipCidrEvent_timestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ByoipCidrEvent -> f ByoipCidrEvent
byoipCidrEvent_timestamp = (ByoipCidrEvent -> Maybe POSIX)
-> (ByoipCidrEvent -> Maybe POSIX -> ByoipCidrEvent)
-> Lens ByoipCidrEvent ByoipCidrEvent (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ByoipCidrEvent' {Maybe POSIX
timestamp :: Maybe POSIX
$sel:timestamp:ByoipCidrEvent' :: ByoipCidrEvent -> Maybe POSIX
timestamp} -> Maybe POSIX
timestamp) (\s :: ByoipCidrEvent
s@ByoipCidrEvent' {} Maybe POSIX
a -> ByoipCidrEvent
s {$sel:timestamp:ByoipCidrEvent' :: Maybe POSIX
timestamp = Maybe POSIX
a} :: ByoipCidrEvent) ((Maybe POSIX -> f (Maybe POSIX))
 -> ByoipCidrEvent -> f ByoipCidrEvent)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ByoipCidrEvent
-> f ByoipCidrEvent
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

instance Core.FromJSON ByoipCidrEvent where
  parseJSON :: Value -> Parser ByoipCidrEvent
parseJSON =
    String
-> (Object -> Parser ByoipCidrEvent)
-> Value
-> Parser ByoipCidrEvent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ByoipCidrEvent"
      ( \Object
x ->
          Maybe Text -> Maybe POSIX -> ByoipCidrEvent
ByoipCidrEvent'
            (Maybe Text -> Maybe POSIX -> ByoipCidrEvent)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> ByoipCidrEvent)
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
"Message")
            Parser (Maybe POSIX -> ByoipCidrEvent)
-> Parser (Maybe POSIX) -> Parser ByoipCidrEvent
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
"Timestamp")
      )

instance Prelude.Hashable ByoipCidrEvent

instance Prelude.NFData ByoipCidrEvent