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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSMIncidents.Types.IncidentRecordSource
import Amazonka.SSMIncidents.Types.IncidentRecordStatus

-- | Details describing an incident record.
--
-- /See:/ 'newIncidentRecordSummary' smart constructor.
data IncidentRecordSummary = IncidentRecordSummary'
  { -- | The time the incident was resolved.
    IncidentRecordSummary -> Maybe POSIX
resolvedTime :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the incident.
    IncidentRecordSummary -> Text
arn :: Prelude.Text,
    -- | The time the incident was created.
    IncidentRecordSummary -> POSIX
creationTime :: Core.POSIX,
    -- | Defines the impact to customers and applications.
    IncidentRecordSummary -> Natural
impact :: Prelude.Natural,
    -- | What caused Incident Manager to create the incident.
    IncidentRecordSummary -> IncidentRecordSource
incidentRecordSource :: IncidentRecordSource,
    -- | The current status of the incident.
    IncidentRecordSummary -> IncidentRecordStatus
status :: IncidentRecordStatus,
    -- | The title of the incident. This value is either provided by the response
    -- plan or overwritten on creation.
    IncidentRecordSummary -> Text
title :: Prelude.Text
  }
  deriving (IncidentRecordSummary -> IncidentRecordSummary -> Bool
(IncidentRecordSummary -> IncidentRecordSummary -> Bool)
-> (IncidentRecordSummary -> IncidentRecordSummary -> Bool)
-> Eq IncidentRecordSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IncidentRecordSummary -> IncidentRecordSummary -> Bool
$c/= :: IncidentRecordSummary -> IncidentRecordSummary -> Bool
== :: IncidentRecordSummary -> IncidentRecordSummary -> Bool
$c== :: IncidentRecordSummary -> IncidentRecordSummary -> Bool
Prelude.Eq, ReadPrec [IncidentRecordSummary]
ReadPrec IncidentRecordSummary
Int -> ReadS IncidentRecordSummary
ReadS [IncidentRecordSummary]
(Int -> ReadS IncidentRecordSummary)
-> ReadS [IncidentRecordSummary]
-> ReadPrec IncidentRecordSummary
-> ReadPrec [IncidentRecordSummary]
-> Read IncidentRecordSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IncidentRecordSummary]
$creadListPrec :: ReadPrec [IncidentRecordSummary]
readPrec :: ReadPrec IncidentRecordSummary
$creadPrec :: ReadPrec IncidentRecordSummary
readList :: ReadS [IncidentRecordSummary]
$creadList :: ReadS [IncidentRecordSummary]
readsPrec :: Int -> ReadS IncidentRecordSummary
$creadsPrec :: Int -> ReadS IncidentRecordSummary
Prelude.Read, Int -> IncidentRecordSummary -> ShowS
[IncidentRecordSummary] -> ShowS
IncidentRecordSummary -> String
(Int -> IncidentRecordSummary -> ShowS)
-> (IncidentRecordSummary -> String)
-> ([IncidentRecordSummary] -> ShowS)
-> Show IncidentRecordSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IncidentRecordSummary] -> ShowS
$cshowList :: [IncidentRecordSummary] -> ShowS
show :: IncidentRecordSummary -> String
$cshow :: IncidentRecordSummary -> String
showsPrec :: Int -> IncidentRecordSummary -> ShowS
$cshowsPrec :: Int -> IncidentRecordSummary -> ShowS
Prelude.Show, (forall x. IncidentRecordSummary -> Rep IncidentRecordSummary x)
-> (forall x. Rep IncidentRecordSummary x -> IncidentRecordSummary)
-> Generic IncidentRecordSummary
forall x. Rep IncidentRecordSummary x -> IncidentRecordSummary
forall x. IncidentRecordSummary -> Rep IncidentRecordSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IncidentRecordSummary x -> IncidentRecordSummary
$cfrom :: forall x. IncidentRecordSummary -> Rep IncidentRecordSummary x
Prelude.Generic)

-- |
-- Create a value of 'IncidentRecordSummary' 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:
--
-- 'resolvedTime', 'incidentRecordSummary_resolvedTime' - The time the incident was resolved.
--
-- 'arn', 'incidentRecordSummary_arn' - The Amazon Resource Name (ARN) of the incident.
--
-- 'creationTime', 'incidentRecordSummary_creationTime' - The time the incident was created.
--
-- 'impact', 'incidentRecordSummary_impact' - Defines the impact to customers and applications.
--
-- 'incidentRecordSource', 'incidentRecordSummary_incidentRecordSource' - What caused Incident Manager to create the incident.
--
-- 'status', 'incidentRecordSummary_status' - The current status of the incident.
--
-- 'title', 'incidentRecordSummary_title' - The title of the incident. This value is either provided by the response
-- plan or overwritten on creation.
newIncidentRecordSummary ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'creationTime'
  Prelude.UTCTime ->
  -- | 'impact'
  Prelude.Natural ->
  -- | 'incidentRecordSource'
  IncidentRecordSource ->
  -- | 'status'
  IncidentRecordStatus ->
  -- | 'title'
  Prelude.Text ->
  IncidentRecordSummary
newIncidentRecordSummary :: Text
-> UTCTime
-> Natural
-> IncidentRecordSource
-> IncidentRecordStatus
-> Text
-> IncidentRecordSummary
newIncidentRecordSummary
  Text
pArn_
  UTCTime
pCreationTime_
  Natural
pImpact_
  IncidentRecordSource
pIncidentRecordSource_
  IncidentRecordStatus
pStatus_
  Text
pTitle_ =
    IncidentRecordSummary' :: Maybe POSIX
-> Text
-> POSIX
-> Natural
-> IncidentRecordSource
-> IncidentRecordStatus
-> Text
-> IncidentRecordSummary
IncidentRecordSummary'
      { $sel:resolvedTime:IncidentRecordSummary' :: Maybe POSIX
resolvedTime =
          Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:arn:IncidentRecordSummary' :: Text
arn = Text
pArn_,
        $sel:creationTime:IncidentRecordSummary' :: POSIX
creationTime = 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
pCreationTime_,
        $sel:impact:IncidentRecordSummary' :: Natural
impact = Natural
pImpact_,
        $sel:incidentRecordSource:IncidentRecordSummary' :: IncidentRecordSource
incidentRecordSource = IncidentRecordSource
pIncidentRecordSource_,
        $sel:status:IncidentRecordSummary' :: IncidentRecordStatus
status = IncidentRecordStatus
pStatus_,
        $sel:title:IncidentRecordSummary' :: Text
title = Text
pTitle_
      }

-- | The time the incident was resolved.
incidentRecordSummary_resolvedTime :: Lens.Lens' IncidentRecordSummary (Prelude.Maybe Prelude.UTCTime)
incidentRecordSummary_resolvedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> IncidentRecordSummary -> f IncidentRecordSummary
incidentRecordSummary_resolvedTime = (IncidentRecordSummary -> Maybe POSIX)
-> (IncidentRecordSummary -> Maybe POSIX -> IncidentRecordSummary)
-> Lens
     IncidentRecordSummary
     IncidentRecordSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentRecordSummary' {Maybe POSIX
resolvedTime :: Maybe POSIX
$sel:resolvedTime:IncidentRecordSummary' :: IncidentRecordSummary -> Maybe POSIX
resolvedTime} -> Maybe POSIX
resolvedTime) (\s :: IncidentRecordSummary
s@IncidentRecordSummary' {} Maybe POSIX
a -> IncidentRecordSummary
s {$sel:resolvedTime:IncidentRecordSummary' :: Maybe POSIX
resolvedTime = Maybe POSIX
a} :: IncidentRecordSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> IncidentRecordSummary -> f IncidentRecordSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> IncidentRecordSummary
-> f IncidentRecordSummary
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

-- | The Amazon Resource Name (ARN) of the incident.
incidentRecordSummary_arn :: Lens.Lens' IncidentRecordSummary Prelude.Text
incidentRecordSummary_arn :: (Text -> f Text)
-> IncidentRecordSummary -> f IncidentRecordSummary
incidentRecordSummary_arn = (IncidentRecordSummary -> Text)
-> (IncidentRecordSummary -> Text -> IncidentRecordSummary)
-> Lens IncidentRecordSummary IncidentRecordSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentRecordSummary' {Text
arn :: Text
$sel:arn:IncidentRecordSummary' :: IncidentRecordSummary -> Text
arn} -> Text
arn) (\s :: IncidentRecordSummary
s@IncidentRecordSummary' {} Text
a -> IncidentRecordSummary
s {$sel:arn:IncidentRecordSummary' :: Text
arn = Text
a} :: IncidentRecordSummary)

-- | The time the incident was created.
incidentRecordSummary_creationTime :: Lens.Lens' IncidentRecordSummary Prelude.UTCTime
incidentRecordSummary_creationTime :: (UTCTime -> f UTCTime)
-> IncidentRecordSummary -> f IncidentRecordSummary
incidentRecordSummary_creationTime = (IncidentRecordSummary -> POSIX)
-> (IncidentRecordSummary -> POSIX -> IncidentRecordSummary)
-> Lens IncidentRecordSummary IncidentRecordSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentRecordSummary' {POSIX
creationTime :: POSIX
$sel:creationTime:IncidentRecordSummary' :: IncidentRecordSummary -> POSIX
creationTime} -> POSIX
creationTime) (\s :: IncidentRecordSummary
s@IncidentRecordSummary' {} POSIX
a -> IncidentRecordSummary
s {$sel:creationTime:IncidentRecordSummary' :: POSIX
creationTime = POSIX
a} :: IncidentRecordSummary) ((POSIX -> f POSIX)
 -> IncidentRecordSummary -> f IncidentRecordSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> IncidentRecordSummary
-> f IncidentRecordSummary
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

-- | Defines the impact to customers and applications.
incidentRecordSummary_impact :: Lens.Lens' IncidentRecordSummary Prelude.Natural
incidentRecordSummary_impact :: (Natural -> f Natural)
-> IncidentRecordSummary -> f IncidentRecordSummary
incidentRecordSummary_impact = (IncidentRecordSummary -> Natural)
-> (IncidentRecordSummary -> Natural -> IncidentRecordSummary)
-> Lens IncidentRecordSummary IncidentRecordSummary Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentRecordSummary' {Natural
impact :: Natural
$sel:impact:IncidentRecordSummary' :: IncidentRecordSummary -> Natural
impact} -> Natural
impact) (\s :: IncidentRecordSummary
s@IncidentRecordSummary' {} Natural
a -> IncidentRecordSummary
s {$sel:impact:IncidentRecordSummary' :: Natural
impact = Natural
a} :: IncidentRecordSummary)

-- | What caused Incident Manager to create the incident.
incidentRecordSummary_incidentRecordSource :: Lens.Lens' IncidentRecordSummary IncidentRecordSource
incidentRecordSummary_incidentRecordSource :: (IncidentRecordSource -> f IncidentRecordSource)
-> IncidentRecordSummary -> f IncidentRecordSummary
incidentRecordSummary_incidentRecordSource = (IncidentRecordSummary -> IncidentRecordSource)
-> (IncidentRecordSummary
    -> IncidentRecordSource -> IncidentRecordSummary)
-> Lens
     IncidentRecordSummary
     IncidentRecordSummary
     IncidentRecordSource
     IncidentRecordSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentRecordSummary' {IncidentRecordSource
incidentRecordSource :: IncidentRecordSource
$sel:incidentRecordSource:IncidentRecordSummary' :: IncidentRecordSummary -> IncidentRecordSource
incidentRecordSource} -> IncidentRecordSource
incidentRecordSource) (\s :: IncidentRecordSummary
s@IncidentRecordSummary' {} IncidentRecordSource
a -> IncidentRecordSummary
s {$sel:incidentRecordSource:IncidentRecordSummary' :: IncidentRecordSource
incidentRecordSource = IncidentRecordSource
a} :: IncidentRecordSummary)

-- | The current status of the incident.
incidentRecordSummary_status :: Lens.Lens' IncidentRecordSummary IncidentRecordStatus
incidentRecordSummary_status :: (IncidentRecordStatus -> f IncidentRecordStatus)
-> IncidentRecordSummary -> f IncidentRecordSummary
incidentRecordSummary_status = (IncidentRecordSummary -> IncidentRecordStatus)
-> (IncidentRecordSummary
    -> IncidentRecordStatus -> IncidentRecordSummary)
-> Lens
     IncidentRecordSummary
     IncidentRecordSummary
     IncidentRecordStatus
     IncidentRecordStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentRecordSummary' {IncidentRecordStatus
status :: IncidentRecordStatus
$sel:status:IncidentRecordSummary' :: IncidentRecordSummary -> IncidentRecordStatus
status} -> IncidentRecordStatus
status) (\s :: IncidentRecordSummary
s@IncidentRecordSummary' {} IncidentRecordStatus
a -> IncidentRecordSummary
s {$sel:status:IncidentRecordSummary' :: IncidentRecordStatus
status = IncidentRecordStatus
a} :: IncidentRecordSummary)

-- | The title of the incident. This value is either provided by the response
-- plan or overwritten on creation.
incidentRecordSummary_title :: Lens.Lens' IncidentRecordSummary Prelude.Text
incidentRecordSummary_title :: (Text -> f Text)
-> IncidentRecordSummary -> f IncidentRecordSummary
incidentRecordSummary_title = (IncidentRecordSummary -> Text)
-> (IncidentRecordSummary -> Text -> IncidentRecordSummary)
-> Lens IncidentRecordSummary IncidentRecordSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncidentRecordSummary' {Text
title :: Text
$sel:title:IncidentRecordSummary' :: IncidentRecordSummary -> Text
title} -> Text
title) (\s :: IncidentRecordSummary
s@IncidentRecordSummary' {} Text
a -> IncidentRecordSummary
s {$sel:title:IncidentRecordSummary' :: Text
title = Text
a} :: IncidentRecordSummary)

instance Core.FromJSON IncidentRecordSummary where
  parseJSON :: Value -> Parser IncidentRecordSummary
parseJSON =
    String
-> (Object -> Parser IncidentRecordSummary)
-> Value
-> Parser IncidentRecordSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IncidentRecordSummary"
      ( \Object
x ->
          Maybe POSIX
-> Text
-> POSIX
-> Natural
-> IncidentRecordSource
-> IncidentRecordStatus
-> Text
-> IncidentRecordSummary
IncidentRecordSummary'
            (Maybe POSIX
 -> Text
 -> POSIX
 -> Natural
 -> IncidentRecordSource
 -> IncidentRecordStatus
 -> Text
 -> IncidentRecordSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Text
      -> POSIX
      -> Natural
      -> IncidentRecordSource
      -> IncidentRecordStatus
      -> Text
      -> IncidentRecordSummary)
forall (f :: * -> *) a b. Functor 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
"resolvedTime")
            Parser
  (Text
   -> POSIX
   -> Natural
   -> IncidentRecordSource
   -> IncidentRecordStatus
   -> Text
   -> IncidentRecordSummary)
-> Parser Text
-> Parser
     (POSIX
      -> Natural
      -> IncidentRecordSource
      -> IncidentRecordStatus
      -> Text
      -> IncidentRecordSummary)
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
"arn")
            Parser
  (POSIX
   -> Natural
   -> IncidentRecordSource
   -> IncidentRecordStatus
   -> Text
   -> IncidentRecordSummary)
-> Parser POSIX
-> Parser
     (Natural
      -> IncidentRecordSource
      -> IncidentRecordStatus
      -> Text
      -> IncidentRecordSummary)
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
"creationTime")
            Parser
  (Natural
   -> IncidentRecordSource
   -> IncidentRecordStatus
   -> Text
   -> IncidentRecordSummary)
-> Parser Natural
-> Parser
     (IncidentRecordSource
      -> IncidentRecordStatus -> Text -> IncidentRecordSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"impact")
            Parser
  (IncidentRecordSource
   -> IncidentRecordStatus -> Text -> IncidentRecordSummary)
-> Parser IncidentRecordSource
-> Parser (IncidentRecordStatus -> Text -> IncidentRecordSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser IncidentRecordSource
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"incidentRecordSource")
            Parser (IncidentRecordStatus -> Text -> IncidentRecordSummary)
-> Parser IncidentRecordStatus
-> Parser (Text -> IncidentRecordSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser IncidentRecordStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser (Text -> IncidentRecordSummary)
-> Parser Text -> Parser IncidentRecordSummary
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
"title")
      )

instance Prelude.Hashable IncidentRecordSummary

instance Prelude.NFData IncidentRecordSummary