{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AWSHealth.Types.OrganizationEventDetailsErrorItem 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

-- | 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,
    -- | 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 Amazon Web
    --     Services account ID in the request.
    --
    -- -   We couldn\'t find an account specific event for the specified Amazon
    --     Web Services account. To find an event that is public, you must
    --     enter a null value for the Amazon Web Services account ID in the
    --     request.
    --
    -- -   Your Amazon Web Services account doesn\'t include the Amazon Web
    --     Services Support plan required to use the Health API. You must have
    --     either a Business, Enterprise On-Ramp, or Enterprise Support plan.
    OrganizationEventDetailsErrorItem -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The name of the error.
    OrganizationEventDetailsErrorItem -> Maybe Text
errorName :: 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
  }
  deriving (OrganizationEventDetailsErrorItem
-> OrganizationEventDetailsErrorItem -> Bool
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]
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
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.
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.
--
-- '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 Amazon Web
--     Services account ID in the request.
--
-- -   We couldn\'t find an account specific event for the specified Amazon
--     Web Services account. To find an event that is public, you must
--     enter a null value for the Amazon Web Services account ID in the
--     request.
--
-- -   Your Amazon Web Services account doesn\'t include the Amazon Web
--     Services Support plan required to use the Health API. You must have
--     either a Business, Enterprise On-Ramp, or Enterprise Support plan.
--
-- 'errorName', 'organizationEventDetailsErrorItem_errorName' - The name of the error.
--
-- '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@
newOrganizationEventDetailsErrorItem ::
  OrganizationEventDetailsErrorItem
newOrganizationEventDetailsErrorItem :: OrganizationEventDetailsErrorItem
newOrganizationEventDetailsErrorItem =
  OrganizationEventDetailsErrorItem'
    { $sel:awsAccountId:OrganizationEventDetailsErrorItem' :: Maybe Text
awsAccountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:OrganizationEventDetailsErrorItem' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:errorName:OrganizationEventDetailsErrorItem' :: Maybe Text
errorName = forall a. Maybe a
Prelude.Nothing,
      $sel:eventArn:OrganizationEventDetailsErrorItem' :: Maybe Text
eventArn = 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 :: Lens' OrganizationEventDetailsErrorItem (Maybe Text)
organizationEventDetailsErrorItem_awsAccountId = 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)

-- | 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 Amazon Web
--     Services account ID in the request.
--
-- -   We couldn\'t find an account specific event for the specified Amazon
--     Web Services account. To find an event that is public, you must
--     enter a null value for the Amazon Web Services account ID in the
--     request.
--
-- -   Your Amazon Web Services account doesn\'t include the Amazon Web
--     Services Support plan required to use the Health API. You must have
--     either a Business, Enterprise On-Ramp, or Enterprise Support plan.
organizationEventDetailsErrorItem_errorMessage :: Lens.Lens' OrganizationEventDetailsErrorItem (Prelude.Maybe Prelude.Text)
organizationEventDetailsErrorItem_errorMessage :: Lens' OrganizationEventDetailsErrorItem (Maybe Text)
organizationEventDetailsErrorItem_errorMessage = 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)

-- | The name of the error.
organizationEventDetailsErrorItem_errorName :: Lens.Lens' OrganizationEventDetailsErrorItem (Prelude.Maybe Prelude.Text)
organizationEventDetailsErrorItem_errorName :: Lens' OrganizationEventDetailsErrorItem (Maybe Text)
organizationEventDetailsErrorItem_errorName = 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)

-- | 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 :: Lens' OrganizationEventDetailsErrorItem (Maybe Text)
organizationEventDetailsErrorItem_eventArn = 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)

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

instance
  Prelude.Hashable
    OrganizationEventDetailsErrorItem
  where
  hashWithSalt :: Int -> OrganizationEventDetailsErrorItem -> Int
hashWithSalt
    Int
_salt
    OrganizationEventDetailsErrorItem' {Maybe Text
eventArn :: Maybe Text
errorName :: Maybe Text
errorMessage :: Maybe Text
awsAccountId :: Maybe Text
$sel:eventArn:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
$sel:errorName:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
$sel:errorMessage:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
$sel:awsAccountId:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsAccountId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventArn

instance
  Prelude.NFData
    OrganizationEventDetailsErrorItem
  where
  rnf :: OrganizationEventDetailsErrorItem -> ()
rnf OrganizationEventDetailsErrorItem' {Maybe Text
eventArn :: Maybe Text
errorName :: Maybe Text
errorMessage :: Maybe Text
awsAccountId :: Maybe Text
$sel:eventArn:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
$sel:errorName:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
$sel:errorMessage:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
$sel:awsAccountId:OrganizationEventDetailsErrorItem' :: OrganizationEventDetailsErrorItem -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventArn