{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SSMIncidents.Types.IncidentRecordSummary 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
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 Data.POSIX,
    -- | The Amazon Resource Name (ARN) of the incident.
    IncidentRecordSummary -> Text
arn :: Prelude.Text,
    -- | The time the incident was created.
    IncidentRecordSummary -> POSIX
creationTime :: Data.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
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]
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
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. 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'
      { $sel:resolvedTime:IncidentRecordSummary' :: Maybe POSIX
resolvedTime =
          forall a. Maybe a
Prelude.Nothing,
        $sel:arn:IncidentRecordSummary' :: Text
arn = Text
pArn_,
        $sel:creationTime:IncidentRecordSummary' :: POSIX
creationTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time 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 :: Lens' IncidentRecordSummary (Maybe UTCTime)
incidentRecordSummary_resolvedTime = 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) 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

-- | The Amazon Resource Name (ARN) of the incident.
incidentRecordSummary_arn :: Lens.Lens' IncidentRecordSummary Prelude.Text
incidentRecordSummary_arn :: Lens' IncidentRecordSummary Text
incidentRecordSummary_arn = 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 :: Lens' IncidentRecordSummary UTCTime
incidentRecordSummary_creationTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Defines the impact to customers and applications.
incidentRecordSummary_impact :: Lens.Lens' IncidentRecordSummary Prelude.Natural
incidentRecordSummary_impact :: Lens' IncidentRecordSummary Natural
incidentRecordSummary_impact = 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 :: Lens' IncidentRecordSummary IncidentRecordSource
incidentRecordSummary_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 :: Lens' IncidentRecordSummary IncidentRecordStatus
incidentRecordSummary_status = 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 :: Lens' IncidentRecordSummary Text
incidentRecordSummary_title = 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 Data.FromJSON IncidentRecordSummary where
  parseJSON :: Value -> Parser IncidentRecordSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IncidentRecordSummary"
      ( \Object
x ->
          Maybe POSIX
-> Text
-> POSIX
-> Natural
-> IncidentRecordSource
-> IncidentRecordStatus
-> Text
-> IncidentRecordSummary
IncidentRecordSummary'
            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
"resolvedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"creationTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"impact")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"incidentRecordSource")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"title")
      )

instance Prelude.Hashable IncidentRecordSummary where
  hashWithSalt :: Int -> IncidentRecordSummary -> Int
hashWithSalt Int
_salt IncidentRecordSummary' {Natural
Maybe POSIX
Text
POSIX
IncidentRecordSource
IncidentRecordStatus
title :: Text
status :: IncidentRecordStatus
incidentRecordSource :: IncidentRecordSource
impact :: Natural
creationTime :: POSIX
arn :: Text
resolvedTime :: Maybe POSIX
$sel:title:IncidentRecordSummary' :: IncidentRecordSummary -> Text
$sel:status:IncidentRecordSummary' :: IncidentRecordSummary -> IncidentRecordStatus
$sel:incidentRecordSource:IncidentRecordSummary' :: IncidentRecordSummary -> IncidentRecordSource
$sel:impact:IncidentRecordSummary' :: IncidentRecordSummary -> Natural
$sel:creationTime:IncidentRecordSummary' :: IncidentRecordSummary -> POSIX
$sel:arn:IncidentRecordSummary' :: IncidentRecordSummary -> Text
$sel:resolvedTime:IncidentRecordSummary' :: IncidentRecordSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
resolvedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
impact
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` IncidentRecordSource
incidentRecordSource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` IncidentRecordStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
title

instance Prelude.NFData IncidentRecordSummary where
  rnf :: IncidentRecordSummary -> ()
rnf IncidentRecordSummary' {Natural
Maybe POSIX
Text
POSIX
IncidentRecordSource
IncidentRecordStatus
title :: Text
status :: IncidentRecordStatus
incidentRecordSource :: IncidentRecordSource
impact :: Natural
creationTime :: POSIX
arn :: Text
resolvedTime :: Maybe POSIX
$sel:title:IncidentRecordSummary' :: IncidentRecordSummary -> Text
$sel:status:IncidentRecordSummary' :: IncidentRecordSummary -> IncidentRecordStatus
$sel:incidentRecordSource:IncidentRecordSummary' :: IncidentRecordSummary -> IncidentRecordSource
$sel:impact:IncidentRecordSummary' :: IncidentRecordSummary -> Natural
$sel:creationTime:IncidentRecordSummary' :: IncidentRecordSummary -> POSIX
$sel:arn:IncidentRecordSummary' :: IncidentRecordSummary -> Text
$sel:resolvedTime:IncidentRecordSummary' :: IncidentRecordSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
resolvedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
impact
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf IncidentRecordSource
incidentRecordSource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf IncidentRecordStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
title