{-# 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.AWSHealth.Types.OrganizationEventDetails
-- 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.AWSHealth.Types.OrganizationEventDetails where

import Amazonka.AWSHealth.Types.Event
import Amazonka.AWSHealth.Types.EventDescription
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Detailed information about an event. A combination of an
-- <https://docs.aws.amazon.com/health/latest/APIReference/API_Event.html Event>
-- object, an
-- <https://docs.aws.amazon.com/health/latest/APIReference/API_EventDescription.html EventDescription>
-- object, and additional metadata about the event. Returned by the
-- <https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetailsForOrganization.html DescribeEventDetailsForOrganization>
-- operation.
--
-- /See:/ 'newOrganizationEventDetails' smart constructor.
data OrganizationEventDetails = OrganizationEventDetails'
  { OrganizationEventDetails -> Maybe Event
event :: Prelude.Maybe Event,
    OrganizationEventDetails -> Maybe EventDescription
eventDescription :: Prelude.Maybe EventDescription,
    -- | The 12-digit AWS account numbers that contains the affected entities.
    OrganizationEventDetails -> Maybe Text
awsAccountId :: Prelude.Maybe Prelude.Text,
    -- | Additional metadata about the event.
    OrganizationEventDetails -> Maybe (HashMap Text Text)
eventMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (OrganizationEventDetails -> OrganizationEventDetails -> Bool
(OrganizationEventDetails -> OrganizationEventDetails -> Bool)
-> (OrganizationEventDetails -> OrganizationEventDetails -> Bool)
-> Eq OrganizationEventDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrganizationEventDetails -> OrganizationEventDetails -> Bool
$c/= :: OrganizationEventDetails -> OrganizationEventDetails -> Bool
== :: OrganizationEventDetails -> OrganizationEventDetails -> Bool
$c== :: OrganizationEventDetails -> OrganizationEventDetails -> Bool
Prelude.Eq, ReadPrec [OrganizationEventDetails]
ReadPrec OrganizationEventDetails
Int -> ReadS OrganizationEventDetails
ReadS [OrganizationEventDetails]
(Int -> ReadS OrganizationEventDetails)
-> ReadS [OrganizationEventDetails]
-> ReadPrec OrganizationEventDetails
-> ReadPrec [OrganizationEventDetails]
-> Read OrganizationEventDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrganizationEventDetails]
$creadListPrec :: ReadPrec [OrganizationEventDetails]
readPrec :: ReadPrec OrganizationEventDetails
$creadPrec :: ReadPrec OrganizationEventDetails
readList :: ReadS [OrganizationEventDetails]
$creadList :: ReadS [OrganizationEventDetails]
readsPrec :: Int -> ReadS OrganizationEventDetails
$creadsPrec :: Int -> ReadS OrganizationEventDetails
Prelude.Read, Int -> OrganizationEventDetails -> ShowS
[OrganizationEventDetails] -> ShowS
OrganizationEventDetails -> String
(Int -> OrganizationEventDetails -> ShowS)
-> (OrganizationEventDetails -> String)
-> ([OrganizationEventDetails] -> ShowS)
-> Show OrganizationEventDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrganizationEventDetails] -> ShowS
$cshowList :: [OrganizationEventDetails] -> ShowS
show :: OrganizationEventDetails -> String
$cshow :: OrganizationEventDetails -> String
showsPrec :: Int -> OrganizationEventDetails -> ShowS
$cshowsPrec :: Int -> OrganizationEventDetails -> ShowS
Prelude.Show, (forall x.
 OrganizationEventDetails -> Rep OrganizationEventDetails x)
-> (forall x.
    Rep OrganizationEventDetails x -> OrganizationEventDetails)
-> Generic OrganizationEventDetails
forall x.
Rep OrganizationEventDetails x -> OrganizationEventDetails
forall x.
OrganizationEventDetails -> Rep OrganizationEventDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OrganizationEventDetails x -> OrganizationEventDetails
$cfrom :: forall x.
OrganizationEventDetails -> Rep OrganizationEventDetails x
Prelude.Generic)

-- |
-- Create a value of 'OrganizationEventDetails' 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:
--
-- 'event', 'organizationEventDetails_event' - Undocumented member.
--
-- 'eventDescription', 'organizationEventDetails_eventDescription' - Undocumented member.
--
-- 'awsAccountId', 'organizationEventDetails_awsAccountId' - The 12-digit AWS account numbers that contains the affected entities.
--
-- 'eventMetadata', 'organizationEventDetails_eventMetadata' - Additional metadata about the event.
newOrganizationEventDetails ::
  OrganizationEventDetails
newOrganizationEventDetails :: OrganizationEventDetails
newOrganizationEventDetails =
  OrganizationEventDetails' :: Maybe Event
-> Maybe EventDescription
-> Maybe Text
-> Maybe (HashMap Text Text)
-> OrganizationEventDetails
OrganizationEventDetails'
    { $sel:event:OrganizationEventDetails' :: Maybe Event
event = Maybe Event
forall a. Maybe a
Prelude.Nothing,
      $sel:eventDescription:OrganizationEventDetails' :: Maybe EventDescription
eventDescription = Maybe EventDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:awsAccountId:OrganizationEventDetails' :: Maybe Text
awsAccountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventMetadata:OrganizationEventDetails' :: Maybe (HashMap Text Text)
eventMetadata = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
organizationEventDetails_event :: Lens.Lens' OrganizationEventDetails (Prelude.Maybe Event)
organizationEventDetails_event :: (Maybe Event -> f (Maybe Event))
-> OrganizationEventDetails -> f OrganizationEventDetails
organizationEventDetails_event = (OrganizationEventDetails -> Maybe Event)
-> (OrganizationEventDetails
    -> Maybe Event -> OrganizationEventDetails)
-> Lens
     OrganizationEventDetails
     OrganizationEventDetails
     (Maybe Event)
     (Maybe Event)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationEventDetails' {Maybe Event
event :: Maybe Event
$sel:event:OrganizationEventDetails' :: OrganizationEventDetails -> Maybe Event
event} -> Maybe Event
event) (\s :: OrganizationEventDetails
s@OrganizationEventDetails' {} Maybe Event
a -> OrganizationEventDetails
s {$sel:event:OrganizationEventDetails' :: Maybe Event
event = Maybe Event
a} :: OrganizationEventDetails)

-- | Undocumented member.
organizationEventDetails_eventDescription :: Lens.Lens' OrganizationEventDetails (Prelude.Maybe EventDescription)
organizationEventDetails_eventDescription :: (Maybe EventDescription -> f (Maybe EventDescription))
-> OrganizationEventDetails -> f OrganizationEventDetails
organizationEventDetails_eventDescription = (OrganizationEventDetails -> Maybe EventDescription)
-> (OrganizationEventDetails
    -> Maybe EventDescription -> OrganizationEventDetails)
-> Lens
     OrganizationEventDetails
     OrganizationEventDetails
     (Maybe EventDescription)
     (Maybe EventDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationEventDetails' {Maybe EventDescription
eventDescription :: Maybe EventDescription
$sel:eventDescription:OrganizationEventDetails' :: OrganizationEventDetails -> Maybe EventDescription
eventDescription} -> Maybe EventDescription
eventDescription) (\s :: OrganizationEventDetails
s@OrganizationEventDetails' {} Maybe EventDescription
a -> OrganizationEventDetails
s {$sel:eventDescription:OrganizationEventDetails' :: Maybe EventDescription
eventDescription = Maybe EventDescription
a} :: OrganizationEventDetails)

-- | The 12-digit AWS account numbers that contains the affected entities.
organizationEventDetails_awsAccountId :: Lens.Lens' OrganizationEventDetails (Prelude.Maybe Prelude.Text)
organizationEventDetails_awsAccountId :: (Maybe Text -> f (Maybe Text))
-> OrganizationEventDetails -> f OrganizationEventDetails
organizationEventDetails_awsAccountId = (OrganizationEventDetails -> Maybe Text)
-> (OrganizationEventDetails
    -> Maybe Text -> OrganizationEventDetails)
-> Lens
     OrganizationEventDetails
     OrganizationEventDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationEventDetails' {Maybe Text
awsAccountId :: Maybe Text
$sel:awsAccountId:OrganizationEventDetails' :: OrganizationEventDetails -> Maybe Text
awsAccountId} -> Maybe Text
awsAccountId) (\s :: OrganizationEventDetails
s@OrganizationEventDetails' {} Maybe Text
a -> OrganizationEventDetails
s {$sel:awsAccountId:OrganizationEventDetails' :: Maybe Text
awsAccountId = Maybe Text
a} :: OrganizationEventDetails)

-- | Additional metadata about the event.
organizationEventDetails_eventMetadata :: Lens.Lens' OrganizationEventDetails (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
organizationEventDetails_eventMetadata :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> OrganizationEventDetails -> f OrganizationEventDetails
organizationEventDetails_eventMetadata = (OrganizationEventDetails -> Maybe (HashMap Text Text))
-> (OrganizationEventDetails
    -> Maybe (HashMap Text Text) -> OrganizationEventDetails)
-> Lens
     OrganizationEventDetails
     OrganizationEventDetails
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationEventDetails' {Maybe (HashMap Text Text)
eventMetadata :: Maybe (HashMap Text Text)
$sel:eventMetadata:OrganizationEventDetails' :: OrganizationEventDetails -> Maybe (HashMap Text Text)
eventMetadata} -> Maybe (HashMap Text Text)
eventMetadata) (\s :: OrganizationEventDetails
s@OrganizationEventDetails' {} Maybe (HashMap Text Text)
a -> OrganizationEventDetails
s {$sel:eventMetadata:OrganizationEventDetails' :: Maybe (HashMap Text Text)
eventMetadata = Maybe (HashMap Text Text)
a} :: OrganizationEventDetails) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> OrganizationEventDetails -> f OrganizationEventDetails)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> OrganizationEventDetails
-> f OrganizationEventDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON OrganizationEventDetails where
  parseJSON :: Value -> Parser OrganizationEventDetails
parseJSON =
    String
-> (Object -> Parser OrganizationEventDetails)
-> Value
-> Parser OrganizationEventDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OrganizationEventDetails"
      ( \Object
x ->
          Maybe Event
-> Maybe EventDescription
-> Maybe Text
-> Maybe (HashMap Text Text)
-> OrganizationEventDetails
OrganizationEventDetails'
            (Maybe Event
 -> Maybe EventDescription
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> OrganizationEventDetails)
-> Parser (Maybe Event)
-> Parser
     (Maybe EventDescription
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> OrganizationEventDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Event)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"event")
            Parser
  (Maybe EventDescription
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> OrganizationEventDetails)
-> Parser (Maybe EventDescription)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text) -> OrganizationEventDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EventDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eventDescription")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text) -> OrganizationEventDetails)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> OrganizationEventDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"awsAccountId")
            Parser (Maybe (HashMap Text Text) -> OrganizationEventDetails)
-> Parser (Maybe (HashMap Text Text))
-> Parser OrganizationEventDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eventMetadata" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable OrganizationEventDetails

instance Prelude.NFData OrganizationEventDetails