{-# 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.AppStream.Types.LastReportGenerationExecutionError
-- 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.AppStream.Types.LastReportGenerationExecutionError where

import Amazonka.AppStream.Types.UsageReportExecutionErrorCode
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

-- | Describes the error that is returned when a usage report can\'t be
-- generated.
--
-- /See:/ 'newLastReportGenerationExecutionError' smart constructor.
data LastReportGenerationExecutionError = LastReportGenerationExecutionError'
  { -- | The error code for the error that is returned when a usage report can\'t
    -- be generated.
    LastReportGenerationExecutionError
-> Maybe UsageReportExecutionErrorCode
errorCode :: Prelude.Maybe UsageReportExecutionErrorCode,
    -- | The error message for the error that is returned when a usage report
    -- can\'t be generated.
    LastReportGenerationExecutionError -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (LastReportGenerationExecutionError
-> LastReportGenerationExecutionError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LastReportGenerationExecutionError
-> LastReportGenerationExecutionError -> Bool
$c/= :: LastReportGenerationExecutionError
-> LastReportGenerationExecutionError -> Bool
== :: LastReportGenerationExecutionError
-> LastReportGenerationExecutionError -> Bool
$c== :: LastReportGenerationExecutionError
-> LastReportGenerationExecutionError -> Bool
Prelude.Eq, ReadPrec [LastReportGenerationExecutionError]
ReadPrec LastReportGenerationExecutionError
Int -> ReadS LastReportGenerationExecutionError
ReadS [LastReportGenerationExecutionError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LastReportGenerationExecutionError]
$creadListPrec :: ReadPrec [LastReportGenerationExecutionError]
readPrec :: ReadPrec LastReportGenerationExecutionError
$creadPrec :: ReadPrec LastReportGenerationExecutionError
readList :: ReadS [LastReportGenerationExecutionError]
$creadList :: ReadS [LastReportGenerationExecutionError]
readsPrec :: Int -> ReadS LastReportGenerationExecutionError
$creadsPrec :: Int -> ReadS LastReportGenerationExecutionError
Prelude.Read, Int -> LastReportGenerationExecutionError -> ShowS
[LastReportGenerationExecutionError] -> ShowS
LastReportGenerationExecutionError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LastReportGenerationExecutionError] -> ShowS
$cshowList :: [LastReportGenerationExecutionError] -> ShowS
show :: LastReportGenerationExecutionError -> String
$cshow :: LastReportGenerationExecutionError -> String
showsPrec :: Int -> LastReportGenerationExecutionError -> ShowS
$cshowsPrec :: Int -> LastReportGenerationExecutionError -> ShowS
Prelude.Show, forall x.
Rep LastReportGenerationExecutionError x
-> LastReportGenerationExecutionError
forall x.
LastReportGenerationExecutionError
-> Rep LastReportGenerationExecutionError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LastReportGenerationExecutionError x
-> LastReportGenerationExecutionError
$cfrom :: forall x.
LastReportGenerationExecutionError
-> Rep LastReportGenerationExecutionError x
Prelude.Generic)

-- |
-- Create a value of 'LastReportGenerationExecutionError' 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:
--
-- 'errorCode', 'lastReportGenerationExecutionError_errorCode' - The error code for the error that is returned when a usage report can\'t
-- be generated.
--
-- 'errorMessage', 'lastReportGenerationExecutionError_errorMessage' - The error message for the error that is returned when a usage report
-- can\'t be generated.
newLastReportGenerationExecutionError ::
  LastReportGenerationExecutionError
newLastReportGenerationExecutionError :: LastReportGenerationExecutionError
newLastReportGenerationExecutionError =
  LastReportGenerationExecutionError'
    { $sel:errorCode:LastReportGenerationExecutionError' :: Maybe UsageReportExecutionErrorCode
errorCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:LastReportGenerationExecutionError' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing
    }

-- | The error code for the error that is returned when a usage report can\'t
-- be generated.
lastReportGenerationExecutionError_errorCode :: Lens.Lens' LastReportGenerationExecutionError (Prelude.Maybe UsageReportExecutionErrorCode)
lastReportGenerationExecutionError_errorCode :: Lens'
  LastReportGenerationExecutionError
  (Maybe UsageReportExecutionErrorCode)
lastReportGenerationExecutionError_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastReportGenerationExecutionError' {Maybe UsageReportExecutionErrorCode
errorCode :: Maybe UsageReportExecutionErrorCode
$sel:errorCode:LastReportGenerationExecutionError' :: LastReportGenerationExecutionError
-> Maybe UsageReportExecutionErrorCode
errorCode} -> Maybe UsageReportExecutionErrorCode
errorCode) (\s :: LastReportGenerationExecutionError
s@LastReportGenerationExecutionError' {} Maybe UsageReportExecutionErrorCode
a -> LastReportGenerationExecutionError
s {$sel:errorCode:LastReportGenerationExecutionError' :: Maybe UsageReportExecutionErrorCode
errorCode = Maybe UsageReportExecutionErrorCode
a} :: LastReportGenerationExecutionError)

-- | The error message for the error that is returned when a usage report
-- can\'t be generated.
lastReportGenerationExecutionError_errorMessage :: Lens.Lens' LastReportGenerationExecutionError (Prelude.Maybe Prelude.Text)
lastReportGenerationExecutionError_errorMessage :: Lens' LastReportGenerationExecutionError (Maybe Text)
lastReportGenerationExecutionError_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastReportGenerationExecutionError' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:LastReportGenerationExecutionError' :: LastReportGenerationExecutionError -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: LastReportGenerationExecutionError
s@LastReportGenerationExecutionError' {} Maybe Text
a -> LastReportGenerationExecutionError
s {$sel:errorMessage:LastReportGenerationExecutionError' :: Maybe Text
errorMessage = Maybe Text
a} :: LastReportGenerationExecutionError)

instance
  Data.FromJSON
    LastReportGenerationExecutionError
  where
  parseJSON :: Value -> Parser LastReportGenerationExecutionError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LastReportGenerationExecutionError"
      ( \Object
x ->
          Maybe UsageReportExecutionErrorCode
-> Maybe Text -> LastReportGenerationExecutionError
LastReportGenerationExecutionError'
            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
"ErrorCode")
            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")
      )

instance
  Prelude.Hashable
    LastReportGenerationExecutionError
  where
  hashWithSalt :: Int -> LastReportGenerationExecutionError -> Int
hashWithSalt
    Int
_salt
    LastReportGenerationExecutionError' {Maybe Text
Maybe UsageReportExecutionErrorCode
errorMessage :: Maybe Text
errorCode :: Maybe UsageReportExecutionErrorCode
$sel:errorMessage:LastReportGenerationExecutionError' :: LastReportGenerationExecutionError -> Maybe Text
$sel:errorCode:LastReportGenerationExecutionError' :: LastReportGenerationExecutionError
-> Maybe UsageReportExecutionErrorCode
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UsageReportExecutionErrorCode
errorCode
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage

instance
  Prelude.NFData
    LastReportGenerationExecutionError
  where
  rnf :: LastReportGenerationExecutionError -> ()
rnf LastReportGenerationExecutionError' {Maybe Text
Maybe UsageReportExecutionErrorCode
errorMessage :: Maybe Text
errorCode :: Maybe UsageReportExecutionErrorCode
$sel:errorMessage:LastReportGenerationExecutionError' :: LastReportGenerationExecutionError -> Maybe Text
$sel:errorCode:LastReportGenerationExecutionError' :: LastReportGenerationExecutionError
-> Maybe UsageReportExecutionErrorCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe UsageReportExecutionErrorCode
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage