{-# 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.ApplicationInsights.Types.ConfigurationEvent
-- 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.ApplicationInsights.Types.ConfigurationEvent where

import Amazonka.ApplicationInsights.Types.ConfigurationEventResourceType
import Amazonka.ApplicationInsights.Types.ConfigurationEventStatus
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

-- | The event information.
--
-- /See:/ 'newConfigurationEvent' smart constructor.
data ConfigurationEvent = ConfigurationEvent'
  { -- | The details of the event in plain text.
    ConfigurationEvent -> Maybe Text
eventDetail :: Prelude.Maybe Prelude.Text,
    -- | The name of the resource Application Insights attempted to configure.
    ConfigurationEvent -> Maybe Text
eventResourceName :: Prelude.Maybe Prelude.Text,
    -- | The resource type that Application Insights attempted to configure, for
    -- example, CLOUDWATCH_ALARM.
    ConfigurationEvent -> Maybe ConfigurationEventResourceType
eventResourceType :: Prelude.Maybe ConfigurationEventResourceType,
    -- | The status of the configuration update event. Possible values include
    -- INFO, WARN, and ERROR.
    ConfigurationEvent -> Maybe ConfigurationEventStatus
eventStatus :: Prelude.Maybe ConfigurationEventStatus,
    -- | The timestamp of the event.
    ConfigurationEvent -> Maybe POSIX
eventTime :: Prelude.Maybe Data.POSIX,
    -- | The resource monitored by Application Insights.
    ConfigurationEvent -> Maybe Text
monitoredResourceARN :: Prelude.Maybe Prelude.Text
  }
  deriving (ConfigurationEvent -> ConfigurationEvent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationEvent -> ConfigurationEvent -> Bool
$c/= :: ConfigurationEvent -> ConfigurationEvent -> Bool
== :: ConfigurationEvent -> ConfigurationEvent -> Bool
$c== :: ConfigurationEvent -> ConfigurationEvent -> Bool
Prelude.Eq, ReadPrec [ConfigurationEvent]
ReadPrec ConfigurationEvent
Int -> ReadS ConfigurationEvent
ReadS [ConfigurationEvent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigurationEvent]
$creadListPrec :: ReadPrec [ConfigurationEvent]
readPrec :: ReadPrec ConfigurationEvent
$creadPrec :: ReadPrec ConfigurationEvent
readList :: ReadS [ConfigurationEvent]
$creadList :: ReadS [ConfigurationEvent]
readsPrec :: Int -> ReadS ConfigurationEvent
$creadsPrec :: Int -> ReadS ConfigurationEvent
Prelude.Read, Int -> ConfigurationEvent -> ShowS
[ConfigurationEvent] -> ShowS
ConfigurationEvent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationEvent] -> ShowS
$cshowList :: [ConfigurationEvent] -> ShowS
show :: ConfigurationEvent -> String
$cshow :: ConfigurationEvent -> String
showsPrec :: Int -> ConfigurationEvent -> ShowS
$cshowsPrec :: Int -> ConfigurationEvent -> ShowS
Prelude.Show, forall x. Rep ConfigurationEvent x -> ConfigurationEvent
forall x. ConfigurationEvent -> Rep ConfigurationEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigurationEvent x -> ConfigurationEvent
$cfrom :: forall x. ConfigurationEvent -> Rep ConfigurationEvent x
Prelude.Generic)

-- |
-- Create a value of 'ConfigurationEvent' 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:
--
-- 'eventDetail', 'configurationEvent_eventDetail' - The details of the event in plain text.
--
-- 'eventResourceName', 'configurationEvent_eventResourceName' - The name of the resource Application Insights attempted to configure.
--
-- 'eventResourceType', 'configurationEvent_eventResourceType' - The resource type that Application Insights attempted to configure, for
-- example, CLOUDWATCH_ALARM.
--
-- 'eventStatus', 'configurationEvent_eventStatus' - The status of the configuration update event. Possible values include
-- INFO, WARN, and ERROR.
--
-- 'eventTime', 'configurationEvent_eventTime' - The timestamp of the event.
--
-- 'monitoredResourceARN', 'configurationEvent_monitoredResourceARN' - The resource monitored by Application Insights.
newConfigurationEvent ::
  ConfigurationEvent
newConfigurationEvent :: ConfigurationEvent
newConfigurationEvent =
  ConfigurationEvent'
    { $sel:eventDetail:ConfigurationEvent' :: Maybe Text
eventDetail = forall a. Maybe a
Prelude.Nothing,
      $sel:eventResourceName:ConfigurationEvent' :: Maybe Text
eventResourceName = forall a. Maybe a
Prelude.Nothing,
      $sel:eventResourceType:ConfigurationEvent' :: Maybe ConfigurationEventResourceType
eventResourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:eventStatus:ConfigurationEvent' :: Maybe ConfigurationEventStatus
eventStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:eventTime:ConfigurationEvent' :: Maybe POSIX
eventTime = forall a. Maybe a
Prelude.Nothing,
      $sel:monitoredResourceARN:ConfigurationEvent' :: Maybe Text
monitoredResourceARN = forall a. Maybe a
Prelude.Nothing
    }

-- | The details of the event in plain text.
configurationEvent_eventDetail :: Lens.Lens' ConfigurationEvent (Prelude.Maybe Prelude.Text)
configurationEvent_eventDetail :: Lens' ConfigurationEvent (Maybe Text)
configurationEvent_eventDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationEvent' {Maybe Text
eventDetail :: Maybe Text
$sel:eventDetail:ConfigurationEvent' :: ConfigurationEvent -> Maybe Text
eventDetail} -> Maybe Text
eventDetail) (\s :: ConfigurationEvent
s@ConfigurationEvent' {} Maybe Text
a -> ConfigurationEvent
s {$sel:eventDetail:ConfigurationEvent' :: Maybe Text
eventDetail = Maybe Text
a} :: ConfigurationEvent)

-- | The name of the resource Application Insights attempted to configure.
configurationEvent_eventResourceName :: Lens.Lens' ConfigurationEvent (Prelude.Maybe Prelude.Text)
configurationEvent_eventResourceName :: Lens' ConfigurationEvent (Maybe Text)
configurationEvent_eventResourceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationEvent' {Maybe Text
eventResourceName :: Maybe Text
$sel:eventResourceName:ConfigurationEvent' :: ConfigurationEvent -> Maybe Text
eventResourceName} -> Maybe Text
eventResourceName) (\s :: ConfigurationEvent
s@ConfigurationEvent' {} Maybe Text
a -> ConfigurationEvent
s {$sel:eventResourceName:ConfigurationEvent' :: Maybe Text
eventResourceName = Maybe Text
a} :: ConfigurationEvent)

-- | The resource type that Application Insights attempted to configure, for
-- example, CLOUDWATCH_ALARM.
configurationEvent_eventResourceType :: Lens.Lens' ConfigurationEvent (Prelude.Maybe ConfigurationEventResourceType)
configurationEvent_eventResourceType :: Lens' ConfigurationEvent (Maybe ConfigurationEventResourceType)
configurationEvent_eventResourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationEvent' {Maybe ConfigurationEventResourceType
eventResourceType :: Maybe ConfigurationEventResourceType
$sel:eventResourceType:ConfigurationEvent' :: ConfigurationEvent -> Maybe ConfigurationEventResourceType
eventResourceType} -> Maybe ConfigurationEventResourceType
eventResourceType) (\s :: ConfigurationEvent
s@ConfigurationEvent' {} Maybe ConfigurationEventResourceType
a -> ConfigurationEvent
s {$sel:eventResourceType:ConfigurationEvent' :: Maybe ConfigurationEventResourceType
eventResourceType = Maybe ConfigurationEventResourceType
a} :: ConfigurationEvent)

-- | The status of the configuration update event. Possible values include
-- INFO, WARN, and ERROR.
configurationEvent_eventStatus :: Lens.Lens' ConfigurationEvent (Prelude.Maybe ConfigurationEventStatus)
configurationEvent_eventStatus :: Lens' ConfigurationEvent (Maybe ConfigurationEventStatus)
configurationEvent_eventStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationEvent' {Maybe ConfigurationEventStatus
eventStatus :: Maybe ConfigurationEventStatus
$sel:eventStatus:ConfigurationEvent' :: ConfigurationEvent -> Maybe ConfigurationEventStatus
eventStatus} -> Maybe ConfigurationEventStatus
eventStatus) (\s :: ConfigurationEvent
s@ConfigurationEvent' {} Maybe ConfigurationEventStatus
a -> ConfigurationEvent
s {$sel:eventStatus:ConfigurationEvent' :: Maybe ConfigurationEventStatus
eventStatus = Maybe ConfigurationEventStatus
a} :: ConfigurationEvent)

-- | The timestamp of the event.
configurationEvent_eventTime :: Lens.Lens' ConfigurationEvent (Prelude.Maybe Prelude.UTCTime)
configurationEvent_eventTime :: Lens' ConfigurationEvent (Maybe UTCTime)
configurationEvent_eventTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationEvent' {Maybe POSIX
eventTime :: Maybe POSIX
$sel:eventTime:ConfigurationEvent' :: ConfigurationEvent -> Maybe POSIX
eventTime} -> Maybe POSIX
eventTime) (\s :: ConfigurationEvent
s@ConfigurationEvent' {} Maybe POSIX
a -> ConfigurationEvent
s {$sel:eventTime:ConfigurationEvent' :: Maybe POSIX
eventTime = Maybe POSIX
a} :: ConfigurationEvent) 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 resource monitored by Application Insights.
configurationEvent_monitoredResourceARN :: Lens.Lens' ConfigurationEvent (Prelude.Maybe Prelude.Text)
configurationEvent_monitoredResourceARN :: Lens' ConfigurationEvent (Maybe Text)
configurationEvent_monitoredResourceARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationEvent' {Maybe Text
monitoredResourceARN :: Maybe Text
$sel:monitoredResourceARN:ConfigurationEvent' :: ConfigurationEvent -> Maybe Text
monitoredResourceARN} -> Maybe Text
monitoredResourceARN) (\s :: ConfigurationEvent
s@ConfigurationEvent' {} Maybe Text
a -> ConfigurationEvent
s {$sel:monitoredResourceARN:ConfigurationEvent' :: Maybe Text
monitoredResourceARN = Maybe Text
a} :: ConfigurationEvent)

instance Data.FromJSON ConfigurationEvent where
  parseJSON :: Value -> Parser ConfigurationEvent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConfigurationEvent"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ConfigurationEventResourceType
-> Maybe ConfigurationEventStatus
-> Maybe POSIX
-> Maybe Text
-> ConfigurationEvent
ConfigurationEvent'
            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
"EventDetail")
            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
"EventResourceName")
            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
"EventResourceType")
            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
"EventStatus")
            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
"EventTime")
            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
"MonitoredResourceARN")
      )

instance Prelude.Hashable ConfigurationEvent where
  hashWithSalt :: Int -> ConfigurationEvent -> Int
hashWithSalt Int
_salt ConfigurationEvent' {Maybe Text
Maybe POSIX
Maybe ConfigurationEventResourceType
Maybe ConfigurationEventStatus
monitoredResourceARN :: Maybe Text
eventTime :: Maybe POSIX
eventStatus :: Maybe ConfigurationEventStatus
eventResourceType :: Maybe ConfigurationEventResourceType
eventResourceName :: Maybe Text
eventDetail :: Maybe Text
$sel:monitoredResourceARN:ConfigurationEvent' :: ConfigurationEvent -> Maybe Text
$sel:eventTime:ConfigurationEvent' :: ConfigurationEvent -> Maybe POSIX
$sel:eventStatus:ConfigurationEvent' :: ConfigurationEvent -> Maybe ConfigurationEventStatus
$sel:eventResourceType:ConfigurationEvent' :: ConfigurationEvent -> Maybe ConfigurationEventResourceType
$sel:eventResourceName:ConfigurationEvent' :: ConfigurationEvent -> Maybe Text
$sel:eventDetail:ConfigurationEvent' :: ConfigurationEvent -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventDetail
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventResourceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConfigurationEventResourceType
eventResourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConfigurationEventStatus
eventStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
eventTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
monitoredResourceARN

instance Prelude.NFData ConfigurationEvent where
  rnf :: ConfigurationEvent -> ()
rnf ConfigurationEvent' {Maybe Text
Maybe POSIX
Maybe ConfigurationEventResourceType
Maybe ConfigurationEventStatus
monitoredResourceARN :: Maybe Text
eventTime :: Maybe POSIX
eventStatus :: Maybe ConfigurationEventStatus
eventResourceType :: Maybe ConfigurationEventResourceType
eventResourceName :: Maybe Text
eventDetail :: Maybe Text
$sel:monitoredResourceARN:ConfigurationEvent' :: ConfigurationEvent -> Maybe Text
$sel:eventTime:ConfigurationEvent' :: ConfigurationEvent -> Maybe POSIX
$sel:eventStatus:ConfigurationEvent' :: ConfigurationEvent -> Maybe ConfigurationEventStatus
$sel:eventResourceType:ConfigurationEvent' :: ConfigurationEvent -> Maybe ConfigurationEventResourceType
$sel:eventResourceName:ConfigurationEvent' :: ConfigurationEvent -> Maybe Text
$sel:eventDetail:ConfigurationEvent' :: ConfigurationEvent -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventDetail
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventResourceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConfigurationEventResourceType
eventResourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConfigurationEventStatus
eventStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
eventTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
monitoredResourceARN