{-# 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.Redshift.Types.EventInfoMap
-- 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.Redshift.Types.EventInfoMap where

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

-- | Describes event information.
--
-- /See:/ 'newEventInfoMap' smart constructor.
data EventInfoMap = EventInfoMap'
  { -- | The description of an Amazon Redshift event.
    EventInfoMap -> Maybe Text
eventDescription :: Prelude.Maybe Prelude.Text,
    -- | The severity of the event.
    --
    -- Values: ERROR, INFO
    EventInfoMap -> Maybe Text
severity :: Prelude.Maybe Prelude.Text,
    -- | The category of an Amazon Redshift event.
    EventInfoMap -> Maybe [Text]
eventCategories :: Prelude.Maybe [Prelude.Text],
    -- | The identifier of an Amazon Redshift event.
    EventInfoMap -> Maybe Text
eventId :: Prelude.Maybe Prelude.Text
  }
  deriving (EventInfoMap -> EventInfoMap -> Bool
(EventInfoMap -> EventInfoMap -> Bool)
-> (EventInfoMap -> EventInfoMap -> Bool) -> Eq EventInfoMap
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventInfoMap -> EventInfoMap -> Bool
$c/= :: EventInfoMap -> EventInfoMap -> Bool
== :: EventInfoMap -> EventInfoMap -> Bool
$c== :: EventInfoMap -> EventInfoMap -> Bool
Prelude.Eq, ReadPrec [EventInfoMap]
ReadPrec EventInfoMap
Int -> ReadS EventInfoMap
ReadS [EventInfoMap]
(Int -> ReadS EventInfoMap)
-> ReadS [EventInfoMap]
-> ReadPrec EventInfoMap
-> ReadPrec [EventInfoMap]
-> Read EventInfoMap
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventInfoMap]
$creadListPrec :: ReadPrec [EventInfoMap]
readPrec :: ReadPrec EventInfoMap
$creadPrec :: ReadPrec EventInfoMap
readList :: ReadS [EventInfoMap]
$creadList :: ReadS [EventInfoMap]
readsPrec :: Int -> ReadS EventInfoMap
$creadsPrec :: Int -> ReadS EventInfoMap
Prelude.Read, Int -> EventInfoMap -> ShowS
[EventInfoMap] -> ShowS
EventInfoMap -> String
(Int -> EventInfoMap -> ShowS)
-> (EventInfoMap -> String)
-> ([EventInfoMap] -> ShowS)
-> Show EventInfoMap
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventInfoMap] -> ShowS
$cshowList :: [EventInfoMap] -> ShowS
show :: EventInfoMap -> String
$cshow :: EventInfoMap -> String
showsPrec :: Int -> EventInfoMap -> ShowS
$cshowsPrec :: Int -> EventInfoMap -> ShowS
Prelude.Show, (forall x. EventInfoMap -> Rep EventInfoMap x)
-> (forall x. Rep EventInfoMap x -> EventInfoMap)
-> Generic EventInfoMap
forall x. Rep EventInfoMap x -> EventInfoMap
forall x. EventInfoMap -> Rep EventInfoMap x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventInfoMap x -> EventInfoMap
$cfrom :: forall x. EventInfoMap -> Rep EventInfoMap x
Prelude.Generic)

-- |
-- Create a value of 'EventInfoMap' 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:
--
-- 'eventDescription', 'eventInfoMap_eventDescription' - The description of an Amazon Redshift event.
--
-- 'severity', 'eventInfoMap_severity' - The severity of the event.
--
-- Values: ERROR, INFO
--
-- 'eventCategories', 'eventInfoMap_eventCategories' - The category of an Amazon Redshift event.
--
-- 'eventId', 'eventInfoMap_eventId' - The identifier of an Amazon Redshift event.
newEventInfoMap ::
  EventInfoMap
newEventInfoMap :: EventInfoMap
newEventInfoMap =
  EventInfoMap' :: Maybe Text
-> Maybe Text -> Maybe [Text] -> Maybe Text -> EventInfoMap
EventInfoMap'
    { $sel:eventDescription:EventInfoMap' :: Maybe Text
eventDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:severity:EventInfoMap' :: Maybe Text
severity = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventCategories:EventInfoMap' :: Maybe [Text]
eventCategories = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:eventId:EventInfoMap' :: Maybe Text
eventId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The description of an Amazon Redshift event.
eventInfoMap_eventDescription :: Lens.Lens' EventInfoMap (Prelude.Maybe Prelude.Text)
eventInfoMap_eventDescription :: (Maybe Text -> f (Maybe Text)) -> EventInfoMap -> f EventInfoMap
eventInfoMap_eventDescription = (EventInfoMap -> Maybe Text)
-> (EventInfoMap -> Maybe Text -> EventInfoMap)
-> Lens EventInfoMap EventInfoMap (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventInfoMap' {Maybe Text
eventDescription :: Maybe Text
$sel:eventDescription:EventInfoMap' :: EventInfoMap -> Maybe Text
eventDescription} -> Maybe Text
eventDescription) (\s :: EventInfoMap
s@EventInfoMap' {} Maybe Text
a -> EventInfoMap
s {$sel:eventDescription:EventInfoMap' :: Maybe Text
eventDescription = Maybe Text
a} :: EventInfoMap)

-- | The severity of the event.
--
-- Values: ERROR, INFO
eventInfoMap_severity :: Lens.Lens' EventInfoMap (Prelude.Maybe Prelude.Text)
eventInfoMap_severity :: (Maybe Text -> f (Maybe Text)) -> EventInfoMap -> f EventInfoMap
eventInfoMap_severity = (EventInfoMap -> Maybe Text)
-> (EventInfoMap -> Maybe Text -> EventInfoMap)
-> Lens EventInfoMap EventInfoMap (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventInfoMap' {Maybe Text
severity :: Maybe Text
$sel:severity:EventInfoMap' :: EventInfoMap -> Maybe Text
severity} -> Maybe Text
severity) (\s :: EventInfoMap
s@EventInfoMap' {} Maybe Text
a -> EventInfoMap
s {$sel:severity:EventInfoMap' :: Maybe Text
severity = Maybe Text
a} :: EventInfoMap)

-- | The category of an Amazon Redshift event.
eventInfoMap_eventCategories :: Lens.Lens' EventInfoMap (Prelude.Maybe [Prelude.Text])
eventInfoMap_eventCategories :: (Maybe [Text] -> f (Maybe [Text]))
-> EventInfoMap -> f EventInfoMap
eventInfoMap_eventCategories = (EventInfoMap -> Maybe [Text])
-> (EventInfoMap -> Maybe [Text] -> EventInfoMap)
-> Lens EventInfoMap EventInfoMap (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventInfoMap' {Maybe [Text]
eventCategories :: Maybe [Text]
$sel:eventCategories:EventInfoMap' :: EventInfoMap -> Maybe [Text]
eventCategories} -> Maybe [Text]
eventCategories) (\s :: EventInfoMap
s@EventInfoMap' {} Maybe [Text]
a -> EventInfoMap
s {$sel:eventCategories:EventInfoMap' :: Maybe [Text]
eventCategories = Maybe [Text]
a} :: EventInfoMap) ((Maybe [Text] -> f (Maybe [Text]))
 -> EventInfoMap -> f EventInfoMap)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> EventInfoMap
-> f EventInfoMap
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of an Amazon Redshift event.
eventInfoMap_eventId :: Lens.Lens' EventInfoMap (Prelude.Maybe Prelude.Text)
eventInfoMap_eventId :: (Maybe Text -> f (Maybe Text)) -> EventInfoMap -> f EventInfoMap
eventInfoMap_eventId = (EventInfoMap -> Maybe Text)
-> (EventInfoMap -> Maybe Text -> EventInfoMap)
-> Lens EventInfoMap EventInfoMap (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventInfoMap' {Maybe Text
eventId :: Maybe Text
$sel:eventId:EventInfoMap' :: EventInfoMap -> Maybe Text
eventId} -> Maybe Text
eventId) (\s :: EventInfoMap
s@EventInfoMap' {} Maybe Text
a -> EventInfoMap
s {$sel:eventId:EventInfoMap' :: Maybe Text
eventId = Maybe Text
a} :: EventInfoMap)

instance Core.FromXML EventInfoMap where
  parseXML :: [Node] -> Either String EventInfoMap
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe [Text] -> Maybe Text -> EventInfoMap
EventInfoMap'
      (Maybe Text
 -> Maybe Text -> Maybe [Text] -> Maybe Text -> EventInfoMap)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe [Text] -> Maybe Text -> EventInfoMap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EventDescription")
      Either
  String (Maybe Text -> Maybe [Text] -> Maybe Text -> EventInfoMap)
-> Either String (Maybe Text)
-> Either String (Maybe [Text] -> Maybe Text -> EventInfoMap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Severity")
      Either String (Maybe [Text] -> Maybe Text -> EventInfoMap)
-> Either String (Maybe [Text])
-> Either String (Maybe Text -> EventInfoMap)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EventCategories" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"EventCategory")
                  )
      Either String (Maybe Text -> EventInfoMap)
-> Either String (Maybe Text) -> Either String EventInfoMap
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EventId")

instance Prelude.Hashable EventInfoMap

instance Prelude.NFData EventInfoMap