{-# 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.SSMIncidents.Types.TimelineEvent
-- 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.SSMIncidents.Types.TimelineEvent where

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

-- | A significant event that happened during the incident.
--
-- /See:/ 'newTimelineEvent' smart constructor.
data TimelineEvent = TimelineEvent'
  { -- | A short description of the event.
    TimelineEvent -> Text
eventData :: Prelude.Text,
    -- | The ID of the timeline event.
    TimelineEvent -> Text
eventId :: Prelude.Text,
    -- | The time that the event occurred.
    TimelineEvent -> POSIX
eventTime :: Core.POSIX,
    -- | The type of event that occurred. Currently Incident Manager supports
    -- only the @Custom Event@ type.
    TimelineEvent -> Text
eventType :: Prelude.Text,
    -- | The time that the timeline event was last updated.
    TimelineEvent -> POSIX
eventUpdatedTime :: Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the incident that the event occurred
    -- during.
    TimelineEvent -> Text
incidentRecordArn :: Prelude.Text
  }
  deriving (TimelineEvent -> TimelineEvent -> Bool
(TimelineEvent -> TimelineEvent -> Bool)
-> (TimelineEvent -> TimelineEvent -> Bool) -> Eq TimelineEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimelineEvent -> TimelineEvent -> Bool
$c/= :: TimelineEvent -> TimelineEvent -> Bool
== :: TimelineEvent -> TimelineEvent -> Bool
$c== :: TimelineEvent -> TimelineEvent -> Bool
Prelude.Eq, ReadPrec [TimelineEvent]
ReadPrec TimelineEvent
Int -> ReadS TimelineEvent
ReadS [TimelineEvent]
(Int -> ReadS TimelineEvent)
-> ReadS [TimelineEvent]
-> ReadPrec TimelineEvent
-> ReadPrec [TimelineEvent]
-> Read TimelineEvent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimelineEvent]
$creadListPrec :: ReadPrec [TimelineEvent]
readPrec :: ReadPrec TimelineEvent
$creadPrec :: ReadPrec TimelineEvent
readList :: ReadS [TimelineEvent]
$creadList :: ReadS [TimelineEvent]
readsPrec :: Int -> ReadS TimelineEvent
$creadsPrec :: Int -> ReadS TimelineEvent
Prelude.Read, Int -> TimelineEvent -> ShowS
[TimelineEvent] -> ShowS
TimelineEvent -> String
(Int -> TimelineEvent -> ShowS)
-> (TimelineEvent -> String)
-> ([TimelineEvent] -> ShowS)
-> Show TimelineEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimelineEvent] -> ShowS
$cshowList :: [TimelineEvent] -> ShowS
show :: TimelineEvent -> String
$cshow :: TimelineEvent -> String
showsPrec :: Int -> TimelineEvent -> ShowS
$cshowsPrec :: Int -> TimelineEvent -> ShowS
Prelude.Show, (forall x. TimelineEvent -> Rep TimelineEvent x)
-> (forall x. Rep TimelineEvent x -> TimelineEvent)
-> Generic TimelineEvent
forall x. Rep TimelineEvent x -> TimelineEvent
forall x. TimelineEvent -> Rep TimelineEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimelineEvent x -> TimelineEvent
$cfrom :: forall x. TimelineEvent -> Rep TimelineEvent x
Prelude.Generic)

-- |
-- Create a value of 'TimelineEvent' 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:
--
-- 'eventData', 'timelineEvent_eventData' - A short description of the event.
--
-- 'eventId', 'timelineEvent_eventId' - The ID of the timeline event.
--
-- 'eventTime', 'timelineEvent_eventTime' - The time that the event occurred.
--
-- 'eventType', 'timelineEvent_eventType' - The type of event that occurred. Currently Incident Manager supports
-- only the @Custom Event@ type.
--
-- 'eventUpdatedTime', 'timelineEvent_eventUpdatedTime' - The time that the timeline event was last updated.
--
-- 'incidentRecordArn', 'timelineEvent_incidentRecordArn' - The Amazon Resource Name (ARN) of the incident that the event occurred
-- during.
newTimelineEvent ::
  -- | 'eventData'
  Prelude.Text ->
  -- | 'eventId'
  Prelude.Text ->
  -- | 'eventTime'
  Prelude.UTCTime ->
  -- | 'eventType'
  Prelude.Text ->
  -- | 'eventUpdatedTime'
  Prelude.UTCTime ->
  -- | 'incidentRecordArn'
  Prelude.Text ->
  TimelineEvent
newTimelineEvent :: Text -> Text -> UTCTime -> Text -> UTCTime -> Text -> TimelineEvent
newTimelineEvent
  Text
pEventData_
  Text
pEventId_
  UTCTime
pEventTime_
  Text
pEventType_
  UTCTime
pEventUpdatedTime_
  Text
pIncidentRecordArn_ =
    TimelineEvent' :: Text -> Text -> POSIX -> Text -> POSIX -> Text -> TimelineEvent
TimelineEvent'
      { $sel:eventData:TimelineEvent' :: Text
eventData = Text
pEventData_,
        $sel:eventId:TimelineEvent' :: Text
eventId = Text
pEventId_,
        $sel:eventTime:TimelineEvent' :: POSIX
eventTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEventTime_,
        $sel:eventType:TimelineEvent' :: Text
eventType = Text
pEventType_,
        $sel:eventUpdatedTime:TimelineEvent' :: POSIX
eventUpdatedTime =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEventUpdatedTime_,
        $sel:incidentRecordArn:TimelineEvent' :: Text
incidentRecordArn = Text
pIncidentRecordArn_
      }

-- | A short description of the event.
timelineEvent_eventData :: Lens.Lens' TimelineEvent Prelude.Text
timelineEvent_eventData :: (Text -> f Text) -> TimelineEvent -> f TimelineEvent
timelineEvent_eventData = (TimelineEvent -> Text)
-> (TimelineEvent -> Text -> TimelineEvent)
-> Lens TimelineEvent TimelineEvent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimelineEvent' {Text
eventData :: Text
$sel:eventData:TimelineEvent' :: TimelineEvent -> Text
eventData} -> Text
eventData) (\s :: TimelineEvent
s@TimelineEvent' {} Text
a -> TimelineEvent
s {$sel:eventData:TimelineEvent' :: Text
eventData = Text
a} :: TimelineEvent)

-- | The ID of the timeline event.
timelineEvent_eventId :: Lens.Lens' TimelineEvent Prelude.Text
timelineEvent_eventId :: (Text -> f Text) -> TimelineEvent -> f TimelineEvent
timelineEvent_eventId = (TimelineEvent -> Text)
-> (TimelineEvent -> Text -> TimelineEvent)
-> Lens TimelineEvent TimelineEvent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimelineEvent' {Text
eventId :: Text
$sel:eventId:TimelineEvent' :: TimelineEvent -> Text
eventId} -> Text
eventId) (\s :: TimelineEvent
s@TimelineEvent' {} Text
a -> TimelineEvent
s {$sel:eventId:TimelineEvent' :: Text
eventId = Text
a} :: TimelineEvent)

-- | The time that the event occurred.
timelineEvent_eventTime :: Lens.Lens' TimelineEvent Prelude.UTCTime
timelineEvent_eventTime :: (UTCTime -> f UTCTime) -> TimelineEvent -> f TimelineEvent
timelineEvent_eventTime = (TimelineEvent -> POSIX)
-> (TimelineEvent -> POSIX -> TimelineEvent)
-> Lens TimelineEvent TimelineEvent POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimelineEvent' {POSIX
eventTime :: POSIX
$sel:eventTime:TimelineEvent' :: TimelineEvent -> POSIX
eventTime} -> POSIX
eventTime) (\s :: TimelineEvent
s@TimelineEvent' {} POSIX
a -> TimelineEvent
s {$sel:eventTime:TimelineEvent' :: POSIX
eventTime = POSIX
a} :: TimelineEvent) ((POSIX -> f POSIX) -> TimelineEvent -> f TimelineEvent)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> TimelineEvent
-> f TimelineEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The type of event that occurred. Currently Incident Manager supports
-- only the @Custom Event@ type.
timelineEvent_eventType :: Lens.Lens' TimelineEvent Prelude.Text
timelineEvent_eventType :: (Text -> f Text) -> TimelineEvent -> f TimelineEvent
timelineEvent_eventType = (TimelineEvent -> Text)
-> (TimelineEvent -> Text -> TimelineEvent)
-> Lens TimelineEvent TimelineEvent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimelineEvent' {Text
eventType :: Text
$sel:eventType:TimelineEvent' :: TimelineEvent -> Text
eventType} -> Text
eventType) (\s :: TimelineEvent
s@TimelineEvent' {} Text
a -> TimelineEvent
s {$sel:eventType:TimelineEvent' :: Text
eventType = Text
a} :: TimelineEvent)

-- | The time that the timeline event was last updated.
timelineEvent_eventUpdatedTime :: Lens.Lens' TimelineEvent Prelude.UTCTime
timelineEvent_eventUpdatedTime :: (UTCTime -> f UTCTime) -> TimelineEvent -> f TimelineEvent
timelineEvent_eventUpdatedTime = (TimelineEvent -> POSIX)
-> (TimelineEvent -> POSIX -> TimelineEvent)
-> Lens TimelineEvent TimelineEvent POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimelineEvent' {POSIX
eventUpdatedTime :: POSIX
$sel:eventUpdatedTime:TimelineEvent' :: TimelineEvent -> POSIX
eventUpdatedTime} -> POSIX
eventUpdatedTime) (\s :: TimelineEvent
s@TimelineEvent' {} POSIX
a -> TimelineEvent
s {$sel:eventUpdatedTime:TimelineEvent' :: POSIX
eventUpdatedTime = POSIX
a} :: TimelineEvent) ((POSIX -> f POSIX) -> TimelineEvent -> f TimelineEvent)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> TimelineEvent
-> f TimelineEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Resource Name (ARN) of the incident that the event occurred
-- during.
timelineEvent_incidentRecordArn :: Lens.Lens' TimelineEvent Prelude.Text
timelineEvent_incidentRecordArn :: (Text -> f Text) -> TimelineEvent -> f TimelineEvent
timelineEvent_incidentRecordArn = (TimelineEvent -> Text)
-> (TimelineEvent -> Text -> TimelineEvent)
-> Lens TimelineEvent TimelineEvent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimelineEvent' {Text
incidentRecordArn :: Text
$sel:incidentRecordArn:TimelineEvent' :: TimelineEvent -> Text
incidentRecordArn} -> Text
incidentRecordArn) (\s :: TimelineEvent
s@TimelineEvent' {} Text
a -> TimelineEvent
s {$sel:incidentRecordArn:TimelineEvent' :: Text
incidentRecordArn = Text
a} :: TimelineEvent)

instance Core.FromJSON TimelineEvent where
  parseJSON :: Value -> Parser TimelineEvent
parseJSON =
    String
-> (Object -> Parser TimelineEvent)
-> Value
-> Parser TimelineEvent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TimelineEvent"
      ( \Object
x ->
          Text -> Text -> POSIX -> Text -> POSIX -> Text -> TimelineEvent
TimelineEvent'
            (Text -> Text -> POSIX -> Text -> POSIX -> Text -> TimelineEvent)
-> Parser Text
-> Parser (Text -> POSIX -> Text -> POSIX -> Text -> TimelineEvent)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"eventData")
            Parser (Text -> POSIX -> Text -> POSIX -> Text -> TimelineEvent)
-> Parser Text
-> Parser (POSIX -> Text -> POSIX -> Text -> TimelineEvent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"eventId")
            Parser (POSIX -> Text -> POSIX -> Text -> TimelineEvent)
-> Parser POSIX -> Parser (Text -> POSIX -> Text -> TimelineEvent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"eventTime")
            Parser (Text -> POSIX -> Text -> TimelineEvent)
-> Parser Text -> Parser (POSIX -> Text -> TimelineEvent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"eventType")
            Parser (POSIX -> Text -> TimelineEvent)
-> Parser POSIX -> Parser (Text -> TimelineEvent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"eventUpdatedTime")
            Parser (Text -> TimelineEvent)
-> Parser Text -> Parser TimelineEvent
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"incidentRecordArn")
      )

instance Prelude.Hashable TimelineEvent

instance Prelude.NFData TimelineEvent