{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.GlobalAccelerator.Types.ByoipCidrEvent 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

-- | A complex type that contains a @Message@ and a @Timestamp@ value for
-- changes that you make in the status of an IP address range that you
-- bring to 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 Global
    -- Accelerator through bring your own IP address (BYOIP).
    ByoipCidrEvent -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | A timestamp for when you make a status change for an IP address range
    -- that you bring to Global Accelerator through bring your own IP address
    -- (BYOIP).
    ByoipCidrEvent -> Maybe POSIX
timestamp :: Prelude.Maybe Data.POSIX
  }
  deriving (ByoipCidrEvent -> ByoipCidrEvent -> Bool
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]
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
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. 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 Global
-- Accelerator through bring your own IP address (BYOIP).
--
-- 'timestamp', 'byoipCidrEvent_timestamp' - A timestamp for when you make a status change for an IP address range
-- that you bring to Global Accelerator through bring your own IP address
-- (BYOIP).
newByoipCidrEvent ::
  ByoipCidrEvent
newByoipCidrEvent :: ByoipCidrEvent
newByoipCidrEvent =
  ByoipCidrEvent'
    { $sel:message:ByoipCidrEvent' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:ByoipCidrEvent' :: Maybe POSIX
timestamp = 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 Global
-- Accelerator through bring your own IP address (BYOIP).
byoipCidrEvent_message :: Lens.Lens' ByoipCidrEvent (Prelude.Maybe Prelude.Text)
byoipCidrEvent_message :: Lens' ByoipCidrEvent (Maybe Text)
byoipCidrEvent_message = 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 for when you make a status change for an IP address range
-- that you bring to Global Accelerator through bring your own IP address
-- (BYOIP).
byoipCidrEvent_timestamp :: Lens.Lens' ByoipCidrEvent (Prelude.Maybe Prelude.UTCTime)
byoipCidrEvent_timestamp :: Lens' ByoipCidrEvent (Maybe UTCTime)
byoipCidrEvent_timestamp = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON ByoipCidrEvent where
  parseJSON :: Value -> Parser ByoipCidrEvent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ByoipCidrEvent"
      ( \Object
x ->
          Maybe Text -> Maybe POSIX -> ByoipCidrEvent
ByoipCidrEvent'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Message")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Timestamp")
      )

instance Prelude.Hashable ByoipCidrEvent where
  hashWithSalt :: Int -> ByoipCidrEvent -> Int
hashWithSalt Int
_salt ByoipCidrEvent' {Maybe Text
Maybe POSIX
timestamp :: Maybe POSIX
message :: Maybe Text
$sel:timestamp:ByoipCidrEvent' :: ByoipCidrEvent -> Maybe POSIX
$sel:message:ByoipCidrEvent' :: ByoipCidrEvent -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
timestamp

instance Prelude.NFData ByoipCidrEvent where
  rnf :: ByoipCidrEvent -> ()
rnf ByoipCidrEvent' {Maybe Text
Maybe POSIX
timestamp :: Maybe POSIX
message :: Maybe Text
$sel:timestamp:ByoipCidrEvent' :: ByoipCidrEvent -> Maybe POSIX
$sel:message:ByoipCidrEvent' :: ByoipCidrEvent -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
timestamp