{-# 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.Athena.Types.UnprocessedNamedQueryId
-- 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.Athena.Types.UnprocessedNamedQueryId where

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

-- | Information about a named query ID that could not be processed.
--
-- /See:/ 'newUnprocessedNamedQueryId' smart constructor.
data UnprocessedNamedQueryId = UnprocessedNamedQueryId'
  { -- | The unique identifier of the named query.
    UnprocessedNamedQueryId -> Maybe Text
namedQueryId :: Prelude.Maybe Prelude.Text,
    -- | The error code returned when the processing request for the named query
    -- failed, if applicable.
    UnprocessedNamedQueryId -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The error message returned when the processing request for the named
    -- query failed, if applicable.
    UnprocessedNamedQueryId -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (UnprocessedNamedQueryId -> UnprocessedNamedQueryId -> Bool
(UnprocessedNamedQueryId -> UnprocessedNamedQueryId -> Bool)
-> (UnprocessedNamedQueryId -> UnprocessedNamedQueryId -> Bool)
-> Eq UnprocessedNamedQueryId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnprocessedNamedQueryId -> UnprocessedNamedQueryId -> Bool
$c/= :: UnprocessedNamedQueryId -> UnprocessedNamedQueryId -> Bool
== :: UnprocessedNamedQueryId -> UnprocessedNamedQueryId -> Bool
$c== :: UnprocessedNamedQueryId -> UnprocessedNamedQueryId -> Bool
Prelude.Eq, ReadPrec [UnprocessedNamedQueryId]
ReadPrec UnprocessedNamedQueryId
Int -> ReadS UnprocessedNamedQueryId
ReadS [UnprocessedNamedQueryId]
(Int -> ReadS UnprocessedNamedQueryId)
-> ReadS [UnprocessedNamedQueryId]
-> ReadPrec UnprocessedNamedQueryId
-> ReadPrec [UnprocessedNamedQueryId]
-> Read UnprocessedNamedQueryId
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnprocessedNamedQueryId]
$creadListPrec :: ReadPrec [UnprocessedNamedQueryId]
readPrec :: ReadPrec UnprocessedNamedQueryId
$creadPrec :: ReadPrec UnprocessedNamedQueryId
readList :: ReadS [UnprocessedNamedQueryId]
$creadList :: ReadS [UnprocessedNamedQueryId]
readsPrec :: Int -> ReadS UnprocessedNamedQueryId
$creadsPrec :: Int -> ReadS UnprocessedNamedQueryId
Prelude.Read, Int -> UnprocessedNamedQueryId -> ShowS
[UnprocessedNamedQueryId] -> ShowS
UnprocessedNamedQueryId -> String
(Int -> UnprocessedNamedQueryId -> ShowS)
-> (UnprocessedNamedQueryId -> String)
-> ([UnprocessedNamedQueryId] -> ShowS)
-> Show UnprocessedNamedQueryId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnprocessedNamedQueryId] -> ShowS
$cshowList :: [UnprocessedNamedQueryId] -> ShowS
show :: UnprocessedNamedQueryId -> String
$cshow :: UnprocessedNamedQueryId -> String
showsPrec :: Int -> UnprocessedNamedQueryId -> ShowS
$cshowsPrec :: Int -> UnprocessedNamedQueryId -> ShowS
Prelude.Show, (forall x.
 UnprocessedNamedQueryId -> Rep UnprocessedNamedQueryId x)
-> (forall x.
    Rep UnprocessedNamedQueryId x -> UnprocessedNamedQueryId)
-> Generic UnprocessedNamedQueryId
forall x. Rep UnprocessedNamedQueryId x -> UnprocessedNamedQueryId
forall x. UnprocessedNamedQueryId -> Rep UnprocessedNamedQueryId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnprocessedNamedQueryId x -> UnprocessedNamedQueryId
$cfrom :: forall x. UnprocessedNamedQueryId -> Rep UnprocessedNamedQueryId x
Prelude.Generic)

-- |
-- Create a value of 'UnprocessedNamedQueryId' 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:
--
-- 'namedQueryId', 'unprocessedNamedQueryId_namedQueryId' - The unique identifier of the named query.
--
-- 'errorCode', 'unprocessedNamedQueryId_errorCode' - The error code returned when the processing request for the named query
-- failed, if applicable.
--
-- 'errorMessage', 'unprocessedNamedQueryId_errorMessage' - The error message returned when the processing request for the named
-- query failed, if applicable.
newUnprocessedNamedQueryId ::
  UnprocessedNamedQueryId
newUnprocessedNamedQueryId :: UnprocessedNamedQueryId
newUnprocessedNamedQueryId =
  UnprocessedNamedQueryId' :: Maybe Text -> Maybe Text -> Maybe Text -> UnprocessedNamedQueryId
UnprocessedNamedQueryId'
    { $sel:namedQueryId:UnprocessedNamedQueryId' :: Maybe Text
namedQueryId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:UnprocessedNamedQueryId' :: Maybe Text
errorCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:UnprocessedNamedQueryId' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The unique identifier of the named query.
unprocessedNamedQueryId_namedQueryId :: Lens.Lens' UnprocessedNamedQueryId (Prelude.Maybe Prelude.Text)
unprocessedNamedQueryId_namedQueryId :: (Maybe Text -> f (Maybe Text))
-> UnprocessedNamedQueryId -> f UnprocessedNamedQueryId
unprocessedNamedQueryId_namedQueryId = (UnprocessedNamedQueryId -> Maybe Text)
-> (UnprocessedNamedQueryId
    -> Maybe Text -> UnprocessedNamedQueryId)
-> Lens
     UnprocessedNamedQueryId
     UnprocessedNamedQueryId
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedNamedQueryId' {Maybe Text
namedQueryId :: Maybe Text
$sel:namedQueryId:UnprocessedNamedQueryId' :: UnprocessedNamedQueryId -> Maybe Text
namedQueryId} -> Maybe Text
namedQueryId) (\s :: UnprocessedNamedQueryId
s@UnprocessedNamedQueryId' {} Maybe Text
a -> UnprocessedNamedQueryId
s {$sel:namedQueryId:UnprocessedNamedQueryId' :: Maybe Text
namedQueryId = Maybe Text
a} :: UnprocessedNamedQueryId)

-- | The error code returned when the processing request for the named query
-- failed, if applicable.
unprocessedNamedQueryId_errorCode :: Lens.Lens' UnprocessedNamedQueryId (Prelude.Maybe Prelude.Text)
unprocessedNamedQueryId_errorCode :: (Maybe Text -> f (Maybe Text))
-> UnprocessedNamedQueryId -> f UnprocessedNamedQueryId
unprocessedNamedQueryId_errorCode = (UnprocessedNamedQueryId -> Maybe Text)
-> (UnprocessedNamedQueryId
    -> Maybe Text -> UnprocessedNamedQueryId)
-> Lens
     UnprocessedNamedQueryId
     UnprocessedNamedQueryId
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedNamedQueryId' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:UnprocessedNamedQueryId' :: UnprocessedNamedQueryId -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: UnprocessedNamedQueryId
s@UnprocessedNamedQueryId' {} Maybe Text
a -> UnprocessedNamedQueryId
s {$sel:errorCode:UnprocessedNamedQueryId' :: Maybe Text
errorCode = Maybe Text
a} :: UnprocessedNamedQueryId)

-- | The error message returned when the processing request for the named
-- query failed, if applicable.
unprocessedNamedQueryId_errorMessage :: Lens.Lens' UnprocessedNamedQueryId (Prelude.Maybe Prelude.Text)
unprocessedNamedQueryId_errorMessage :: (Maybe Text -> f (Maybe Text))
-> UnprocessedNamedQueryId -> f UnprocessedNamedQueryId
unprocessedNamedQueryId_errorMessage = (UnprocessedNamedQueryId -> Maybe Text)
-> (UnprocessedNamedQueryId
    -> Maybe Text -> UnprocessedNamedQueryId)
-> Lens
     UnprocessedNamedQueryId
     UnprocessedNamedQueryId
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedNamedQueryId' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:UnprocessedNamedQueryId' :: UnprocessedNamedQueryId -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: UnprocessedNamedQueryId
s@UnprocessedNamedQueryId' {} Maybe Text
a -> UnprocessedNamedQueryId
s {$sel:errorMessage:UnprocessedNamedQueryId' :: Maybe Text
errorMessage = Maybe Text
a} :: UnprocessedNamedQueryId)

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

instance Prelude.NFData UnprocessedNamedQueryId