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

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

-- | Error information returned when a
-- <https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetailsForOrganization.html DescribeEventDetailsForOrganization>
-- operation can\'t find a specified event.
--
-- /See:/ 'newOrganizationEventDetailsErrorItem' smart constructor.
data OrganizationEventDetailsErrorItem = OrganizationEventDetailsErrorItem'
  { -- | Error information returned when a
    -- <https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetailsForOrganization.html DescribeEventDetailsForOrganization>
    -- operation can\'t find a specified event.
    OrganizationEventDetailsErrorItem -> Maybe Text
awsAccountId :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the event. The event ARN has the
    -- @arn:aws:health:event-region::event\/SERVICE\/EVENT_TYPE_CODE\/EVENT_TYPE_PLUS_ID @
    -- format.
    --
    -- For example, an event ARN might look like the following:
    --
    -- @arn:aws:health:us-east-1::event\/EC2\/EC2_INSTANCE_RETIREMENT_SCHEDULED\/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456@
    OrganizationEventDetailsErrorItem -> Maybe Text
eventArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the error.
    OrganizationEventDetailsErrorItem -> Maybe Text
errorName :: Prelude.Maybe Prelude.Text,
    -- | A message that describes the error.
    --
    -- If you call the @DescribeEventDetailsForOrganization@ operation and
    -- receive one of the following errors, follow the recommendations in the
    -- message:
    --
    -- -   We couldn\'t find a public event that matches your request. To find
    --     an event that is account specific, you must enter an AWS account ID
    --     in the request.
    --
    -- -   We couldn\'t find an account specific event for the specified AWS
    --     account. To find an event that is public, you must enter a null
    --     value for the AWS account ID in the request.
    --
    -- -   Your AWS account doesn\'t include the AWS Support plan required to
    --     use the AWS Health API. You must have either a Business or
    --     Enterprise Support plan.
    OrganizationEventDetailsErrorItem -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (OrganizationEventDetailsErrorItem
-> OrganizationEventDetailsErrorItem -> Bool
(OrganizationEventDetailsErrorItem
 -> OrganizationEventDetailsErrorItem -> Bool)
-> (OrganizationEventDetailsErrorItem
    -> OrganizationEventDetailsErrorItem -> Bool)
-> Eq OrganizationEventDetailsErrorItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrganizationEventDetailsErrorItem
-> OrganizationEventDetailsErrorItem -> Bool
$c/= :: OrganizationEventDetailsErrorItem
-> OrganizationEventDetailsErrorItem -> Bool
== :: OrganizationEventDetailsErrorItem
-> OrganizationEventDetailsErrorItem -> Bool
$c== :: OrganizationEventDetailsErrorItem
-> OrganizationEventDetailsErrorItem -> Bool
Prelude.Eq, ReadPrec [OrganizationEventDetailsErrorItem]
ReadPrec OrganizationEventDetailsErrorItem
Int -> ReadS OrganizationEventDetailsErrorItem
ReadS [OrganizationEventDetailsErrorItem]
(Int -> ReadS OrganizationEventDetailsErrorItem)
-> ReadS [OrganizationEventDetailsErrorItem]
-> ReadPrec OrganizationEventDetailsErrorItem
-> ReadPrec [OrganizationEventDetailsErrorItem]
-> Read OrganizationEventDetailsErrorItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrganizationEventDetailsErrorItem]
$creadListPrec :: ReadPrec [OrganizationEventDetailsErrorItem]
readPrec :: ReadPrec OrganizationEventDetailsErrorItem
$creadPrec :: ReadPrec OrganizationEventDetailsErrorItem
readList :: ReadS [OrganizationEventDetailsErrorItem]
$creadList :: ReadS [OrganizationEventDetailsErrorItem]
readsPrec :: Int -> ReadS OrganizationEventDetailsErrorItem
$creadsPrec :: Int -> ReadS OrganizationEventDetailsErrorItem
Prelude.Read, Int -> OrganizationEventDetailsErrorItem -> ShowS
[OrganizationEventDetailsErrorItem] -> ShowS
OrganizationEventDetailsErrorItem -> String
(Int -> OrganizationEventDetailsErrorItem -> ShowS)
-> (OrganizationEventDetailsErrorItem -> String)
-> ([OrganizationEventDetailsErrorItem] -> ShowS)
-> Show OrganizationEventDetailsErrorItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrganizationEventDetailsErrorItem] -> ShowS
$cshowList :: [OrganizationEventDetailsErrorItem] -> ShowS
show :: OrganizationEventDetailsErrorItem -> String
$cshow :: OrganizationEventDetailsErrorItem -> String
showsPrec :: Int -> OrganizationEventDetailsErrorItem -> ShowS
$cshowsPrec :: Int -> OrganizationEventDetailsErrorItem -> ShowS
Prelude.Show, (forall x.
 OrganizationEventDetailsErrorItem
 -> Rep OrganizationEventDetailsErrorItem x)
-> (forall x.
    Rep OrganizationEventDetailsErrorItem x
    -> OrganizationEventDetailsErrorItem)
-> Generic OrganizationEventDetailsErrorItem
forall x.
Rep OrganizationEventDetailsErrorItem x
-> OrganizationEventDetailsErrorItem
forall x.
OrganizationEventDetailsErrorItem
-> Rep OrganizationEventDetailsErrorItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OrganizationEventDetailsErrorItem x
-> OrganizationEventDetailsErrorItem
$cfrom :: forall x.
OrganizationEventDetailsErrorItem
-> Rep OrganizationEventDetailsErrorItem x
Prelude.Generic)

-- |
-- Create a value of 'OrganizationEventDetailsErrorItem' 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:
--
-- 'awsAccountId', 'organizationEventDetailsErrorItem_awsAccountId' - Error information returned when a
-- <https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetailsForOrganization.html DescribeEventDetailsForOrganization>
-- operation can\'t find a specified event.
--
-- 'eventArn', 'organizationEventDetailsErrorItem_eventArn' - The unique identifier for the event. The event ARN has the
-- @arn:aws:health:event-region::event\/SERVICE\/EVENT_TYPE_CODE\/EVENT_TYPE_PLUS_ID @
-- format.
--
-- For example, an event ARN might look like the following:
--
-- @arn:aws:health:us-east-1::event\/EC2\/EC2_INSTANCE_RETIREMENT_SCHEDULED\/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456@
--
-- 'errorName', 'organizationEventDetailsErrorItem_errorName' - The name of the error.
--
-- 'errorMessage', 'organizationEventDetailsErrorItem_errorMessage' - A message that describes the error.
--
-- If you call the @DescribeEventDetailsForOrganization@ operation and
-- receive one of the following errors, follow the recommendations in the
-- message:
--
-- -   We couldn\'t find a public event that matches your request. To find
--     an event that is account specific, you must enter an AWS account ID
--     in the request.
--
-- -   We couldn\'t find an account specific event for the specified AWS
--     account. To find an event that is public, you must enter a null
--     value for the AWS account ID in the request.
--
-- -   Your AWS account doesn\'t include the AWS Support plan required to
--     use the AWS Health API. You must have either a Business or
--     Enterprise Support plan.
newOrganizationEventDetailsErrorItem ::
  OrganizationEventDetailsErrorItem
newOrganizationEventDetailsErrorItem :: OrganizationEventDetailsErrorItem
newOrganizationEventDetailsErrorItem =
  OrganizationEventDetailsErrorItem' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> OrganizationEventDetailsErrorItem
OrganizationEventDetailsErrorItem'
    { $sel:awsAccountId:OrganizationEventDetailsErrorItem' :: Maybe Text
awsAccountId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventArn:OrganizationEventDetailsErrorItem' :: Maybe Text
eventArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorName:OrganizationEventDetailsErrorItem' :: Maybe Text
errorName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:OrganizationEventDetailsErrorItem' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Error information returned when a
-- <https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetailsForOrganization.html DescribeEventDetailsForOrganization>
-- operation can\'t find a specified event.
organizationEventDetailsErrorItem_awsAccountId :: Lens.Lens' OrganizationEventDetailsErrorItem (Prelude.Maybe Prelude.Text)
organizationEventDetailsErrorItem_awsAccountId :: (Maybe Text -> f (Maybe Text))
-> OrganizationEventDetailsErrorItem
-> f OrganizationEventDetailsErrorItem
organizationEventDetailsErrorItem_awsAccountId = (OrganizationEventDetailsErrorItem -> Maybe Text)
-> (OrganizationEventDetailsErrorItem
    -> Maybe Text -> OrganizationEventDetailsErrorItem)
-> Lens
     OrganizationEventDetailsErrorItem
     OrganizationEventDetailsErrorItem
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationEventDetailsErrorItem' {Maybe Text
awsAccountId :: Maybe Text
$sel:awsAccountId:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
awsAccountId} -> Maybe Text
awsAccountId) (\s :: OrganizationEventDetailsErrorItem
s@OrganizationEventDetailsErrorItem' {} Maybe Text
a -> OrganizationEventDetailsErrorItem
s {$sel:awsAccountId:OrganizationEventDetailsErrorItem' :: Maybe Text
awsAccountId = Maybe Text
a} :: OrganizationEventDetailsErrorItem)

-- | The unique identifier for the event. The event ARN has the
-- @arn:aws:health:event-region::event\/SERVICE\/EVENT_TYPE_CODE\/EVENT_TYPE_PLUS_ID @
-- format.
--
-- For example, an event ARN might look like the following:
--
-- @arn:aws:health:us-east-1::event\/EC2\/EC2_INSTANCE_RETIREMENT_SCHEDULED\/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456@
organizationEventDetailsErrorItem_eventArn :: Lens.Lens' OrganizationEventDetailsErrorItem (Prelude.Maybe Prelude.Text)
organizationEventDetailsErrorItem_eventArn :: (Maybe Text -> f (Maybe Text))
-> OrganizationEventDetailsErrorItem
-> f OrganizationEventDetailsErrorItem
organizationEventDetailsErrorItem_eventArn = (OrganizationEventDetailsErrorItem -> Maybe Text)
-> (OrganizationEventDetailsErrorItem
    -> Maybe Text -> OrganizationEventDetailsErrorItem)
-> Lens
     OrganizationEventDetailsErrorItem
     OrganizationEventDetailsErrorItem
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationEventDetailsErrorItem' {Maybe Text
eventArn :: Maybe Text
$sel:eventArn:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
eventArn} -> Maybe Text
eventArn) (\s :: OrganizationEventDetailsErrorItem
s@OrganizationEventDetailsErrorItem' {} Maybe Text
a -> OrganizationEventDetailsErrorItem
s {$sel:eventArn:OrganizationEventDetailsErrorItem' :: Maybe Text
eventArn = Maybe Text
a} :: OrganizationEventDetailsErrorItem)

-- | The name of the error.
organizationEventDetailsErrorItem_errorName :: Lens.Lens' OrganizationEventDetailsErrorItem (Prelude.Maybe Prelude.Text)
organizationEventDetailsErrorItem_errorName :: (Maybe Text -> f (Maybe Text))
-> OrganizationEventDetailsErrorItem
-> f OrganizationEventDetailsErrorItem
organizationEventDetailsErrorItem_errorName = (OrganizationEventDetailsErrorItem -> Maybe Text)
-> (OrganizationEventDetailsErrorItem
    -> Maybe Text -> OrganizationEventDetailsErrorItem)
-> Lens
     OrganizationEventDetailsErrorItem
     OrganizationEventDetailsErrorItem
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationEventDetailsErrorItem' {Maybe Text
errorName :: Maybe Text
$sel:errorName:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
errorName} -> Maybe Text
errorName) (\s :: OrganizationEventDetailsErrorItem
s@OrganizationEventDetailsErrorItem' {} Maybe Text
a -> OrganizationEventDetailsErrorItem
s {$sel:errorName:OrganizationEventDetailsErrorItem' :: Maybe Text
errorName = Maybe Text
a} :: OrganizationEventDetailsErrorItem)

-- | A message that describes the error.
--
-- If you call the @DescribeEventDetailsForOrganization@ operation and
-- receive one of the following errors, follow the recommendations in the
-- message:
--
-- -   We couldn\'t find a public event that matches your request. To find
--     an event that is account specific, you must enter an AWS account ID
--     in the request.
--
-- -   We couldn\'t find an account specific event for the specified AWS
--     account. To find an event that is public, you must enter a null
--     value for the AWS account ID in the request.
--
-- -   Your AWS account doesn\'t include the AWS Support plan required to
--     use the AWS Health API. You must have either a Business or
--     Enterprise Support plan.
organizationEventDetailsErrorItem_errorMessage :: Lens.Lens' OrganizationEventDetailsErrorItem (Prelude.Maybe Prelude.Text)
organizationEventDetailsErrorItem_errorMessage :: (Maybe Text -> f (Maybe Text))
-> OrganizationEventDetailsErrorItem
-> f OrganizationEventDetailsErrorItem
organizationEventDetailsErrorItem_errorMessage = (OrganizationEventDetailsErrorItem -> Maybe Text)
-> (OrganizationEventDetailsErrorItem
    -> Maybe Text -> OrganizationEventDetailsErrorItem)
-> Lens
     OrganizationEventDetailsErrorItem
     OrganizationEventDetailsErrorItem
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationEventDetailsErrorItem' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: OrganizationEventDetailsErrorItem
s@OrganizationEventDetailsErrorItem' {} Maybe Text
a -> OrganizationEventDetailsErrorItem
s {$sel:errorMessage:OrganizationEventDetailsErrorItem' :: Maybe Text
errorMessage = Maybe Text
a} :: OrganizationEventDetailsErrorItem)

instance
  Core.FromJSON
    OrganizationEventDetailsErrorItem
  where
  parseJSON :: Value -> Parser OrganizationEventDetailsErrorItem
parseJSON =
    String
-> (Object -> Parser OrganizationEventDetailsErrorItem)
-> Value
-> Parser OrganizationEventDetailsErrorItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OrganizationEventDetailsErrorItem"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> OrganizationEventDetailsErrorItem
OrganizationEventDetailsErrorItem'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> OrganizationEventDetailsErrorItem)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> OrganizationEventDetailsErrorItem)
forall (f :: * -> *) a b. Functor 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 Text
   -> Maybe Text -> Maybe Text -> OrganizationEventDetailsErrorItem)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> OrganizationEventDetailsErrorItem)
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
"eventArn")
            Parser
  (Maybe Text -> Maybe Text -> OrganizationEventDetailsErrorItem)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> OrganizationEventDetailsErrorItem)
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
"errorName")
            Parser (Maybe Text -> OrganizationEventDetailsErrorItem)
-> Parser (Maybe Text) -> Parser OrganizationEventDetailsErrorItem
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
"errorMessage")
      )

instance
  Prelude.Hashable
    OrganizationEventDetailsErrorItem

instance
  Prelude.NFData
    OrganizationEventDetailsErrorItem