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

import Amazonka.AppStream.Types.UsageReportExecutionErrorCode
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(LastReportGenerationExecutionError
 -> LastReportGenerationExecutionError -> Bool)
-> (LastReportGenerationExecutionError
    -> LastReportGenerationExecutionError -> Bool)
-> Eq LastReportGenerationExecutionError
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]
(Int -> ReadS LastReportGenerationExecutionError)
-> ReadS [LastReportGenerationExecutionError]
-> ReadPrec LastReportGenerationExecutionError
-> ReadPrec [LastReportGenerationExecutionError]
-> Read 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
(Int -> LastReportGenerationExecutionError -> ShowS)
-> (LastReportGenerationExecutionError -> String)
-> ([LastReportGenerationExecutionError] -> ShowS)
-> Show LastReportGenerationExecutionError
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.
 LastReportGenerationExecutionError
 -> Rep LastReportGenerationExecutionError x)
-> (forall x.
    Rep LastReportGenerationExecutionError x
    -> LastReportGenerationExecutionError)
-> Generic LastReportGenerationExecutionError
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' :: Maybe UsageReportExecutionErrorCode
-> Maybe Text -> LastReportGenerationExecutionError
LastReportGenerationExecutionError'
    { $sel:errorCode:LastReportGenerationExecutionError' :: Maybe UsageReportExecutionErrorCode
errorCode =
        Maybe UsageReportExecutionErrorCode
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:LastReportGenerationExecutionError' :: Maybe Text
errorMessage = Maybe Text
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 :: (Maybe UsageReportExecutionErrorCode
 -> f (Maybe UsageReportExecutionErrorCode))
-> LastReportGenerationExecutionError
-> f LastReportGenerationExecutionError
lastReportGenerationExecutionError_errorCode = (LastReportGenerationExecutionError
 -> Maybe UsageReportExecutionErrorCode)
-> (LastReportGenerationExecutionError
    -> Maybe UsageReportExecutionErrorCode
    -> LastReportGenerationExecutionError)
-> Lens
     LastReportGenerationExecutionError
     LastReportGenerationExecutionError
     (Maybe UsageReportExecutionErrorCode)
     (Maybe UsageReportExecutionErrorCode)
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 :: (Maybe Text -> f (Maybe Text))
-> LastReportGenerationExecutionError
-> f LastReportGenerationExecutionError
lastReportGenerationExecutionError_errorMessage = (LastReportGenerationExecutionError -> Maybe Text)
-> (LastReportGenerationExecutionError
    -> Maybe Text -> LastReportGenerationExecutionError)
-> Lens
     LastReportGenerationExecutionError
     LastReportGenerationExecutionError
     (Maybe Text)
     (Maybe Text)
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
  Core.FromJSON
    LastReportGenerationExecutionError
  where
  parseJSON :: Value -> Parser LastReportGenerationExecutionError
parseJSON =
    String
-> (Object -> Parser LastReportGenerationExecutionError)
-> Value
-> Parser LastReportGenerationExecutionError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LastReportGenerationExecutionError"
      ( \Object
x ->
          Maybe UsageReportExecutionErrorCode
-> Maybe Text -> LastReportGenerationExecutionError
LastReportGenerationExecutionError'
            (Maybe UsageReportExecutionErrorCode
 -> Maybe Text -> LastReportGenerationExecutionError)
-> Parser (Maybe UsageReportExecutionErrorCode)
-> Parser (Maybe Text -> LastReportGenerationExecutionError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe UsageReportExecutionErrorCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorCode")
            Parser (Maybe Text -> LastReportGenerationExecutionError)
-> Parser (Maybe Text) -> Parser LastReportGenerationExecutionError
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
    LastReportGenerationExecutionError

instance
  Prelude.NFData
    LastReportGenerationExecutionError