{-# 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.FraudDetector.Types.BatchGetVariableError
-- 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.FraudDetector.Types.BatchGetVariableError where

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

-- | Provides the error of the batch get variable API.
--
-- /See:/ 'newBatchGetVariableError' smart constructor.
data BatchGetVariableError = BatchGetVariableError'
  { -- | The error name.
    BatchGetVariableError -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The error code.
    BatchGetVariableError -> Maybe Int
code :: Prelude.Maybe Prelude.Int,
    -- | The error message.
    BatchGetVariableError -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchGetVariableError -> BatchGetVariableError -> Bool
(BatchGetVariableError -> BatchGetVariableError -> Bool)
-> (BatchGetVariableError -> BatchGetVariableError -> Bool)
-> Eq BatchGetVariableError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetVariableError -> BatchGetVariableError -> Bool
$c/= :: BatchGetVariableError -> BatchGetVariableError -> Bool
== :: BatchGetVariableError -> BatchGetVariableError -> Bool
$c== :: BatchGetVariableError -> BatchGetVariableError -> Bool
Prelude.Eq, ReadPrec [BatchGetVariableError]
ReadPrec BatchGetVariableError
Int -> ReadS BatchGetVariableError
ReadS [BatchGetVariableError]
(Int -> ReadS BatchGetVariableError)
-> ReadS [BatchGetVariableError]
-> ReadPrec BatchGetVariableError
-> ReadPrec [BatchGetVariableError]
-> Read BatchGetVariableError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetVariableError]
$creadListPrec :: ReadPrec [BatchGetVariableError]
readPrec :: ReadPrec BatchGetVariableError
$creadPrec :: ReadPrec BatchGetVariableError
readList :: ReadS [BatchGetVariableError]
$creadList :: ReadS [BatchGetVariableError]
readsPrec :: Int -> ReadS BatchGetVariableError
$creadsPrec :: Int -> ReadS BatchGetVariableError
Prelude.Read, Int -> BatchGetVariableError -> ShowS
[BatchGetVariableError] -> ShowS
BatchGetVariableError -> String
(Int -> BatchGetVariableError -> ShowS)
-> (BatchGetVariableError -> String)
-> ([BatchGetVariableError] -> ShowS)
-> Show BatchGetVariableError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetVariableError] -> ShowS
$cshowList :: [BatchGetVariableError] -> ShowS
show :: BatchGetVariableError -> String
$cshow :: BatchGetVariableError -> String
showsPrec :: Int -> BatchGetVariableError -> ShowS
$cshowsPrec :: Int -> BatchGetVariableError -> ShowS
Prelude.Show, (forall x. BatchGetVariableError -> Rep BatchGetVariableError x)
-> (forall x. Rep BatchGetVariableError x -> BatchGetVariableError)
-> Generic BatchGetVariableError
forall x. Rep BatchGetVariableError x -> BatchGetVariableError
forall x. BatchGetVariableError -> Rep BatchGetVariableError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetVariableError x -> BatchGetVariableError
$cfrom :: forall x. BatchGetVariableError -> Rep BatchGetVariableError x
Prelude.Generic)

-- |
-- Create a value of 'BatchGetVariableError' 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:
--
-- 'name', 'batchGetVariableError_name' - The error name.
--
-- 'code', 'batchGetVariableError_code' - The error code.
--
-- 'message', 'batchGetVariableError_message' - The error message.
newBatchGetVariableError ::
  BatchGetVariableError
newBatchGetVariableError :: BatchGetVariableError
newBatchGetVariableError =
  BatchGetVariableError' :: Maybe Text -> Maybe Int -> Maybe Text -> BatchGetVariableError
BatchGetVariableError'
    { $sel:name:BatchGetVariableError' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:code:BatchGetVariableError' :: Maybe Int
code = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:message:BatchGetVariableError' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The error code.
batchGetVariableError_code :: Lens.Lens' BatchGetVariableError (Prelude.Maybe Prelude.Int)
batchGetVariableError_code :: (Maybe Int -> f (Maybe Int))
-> BatchGetVariableError -> f BatchGetVariableError
batchGetVariableError_code = (BatchGetVariableError -> Maybe Int)
-> (BatchGetVariableError -> Maybe Int -> BatchGetVariableError)
-> Lens
     BatchGetVariableError BatchGetVariableError (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetVariableError' {Maybe Int
code :: Maybe Int
$sel:code:BatchGetVariableError' :: BatchGetVariableError -> Maybe Int
code} -> Maybe Int
code) (\s :: BatchGetVariableError
s@BatchGetVariableError' {} Maybe Int
a -> BatchGetVariableError
s {$sel:code:BatchGetVariableError' :: Maybe Int
code = Maybe Int
a} :: BatchGetVariableError)

-- | The error message.
batchGetVariableError_message :: Lens.Lens' BatchGetVariableError (Prelude.Maybe Prelude.Text)
batchGetVariableError_message :: (Maybe Text -> f (Maybe Text))
-> BatchGetVariableError -> f BatchGetVariableError
batchGetVariableError_message = (BatchGetVariableError -> Maybe Text)
-> (BatchGetVariableError -> Maybe Text -> BatchGetVariableError)
-> Lens
     BatchGetVariableError
     BatchGetVariableError
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetVariableError' {Maybe Text
message :: Maybe Text
$sel:message:BatchGetVariableError' :: BatchGetVariableError -> Maybe Text
message} -> Maybe Text
message) (\s :: BatchGetVariableError
s@BatchGetVariableError' {} Maybe Text
a -> BatchGetVariableError
s {$sel:message:BatchGetVariableError' :: Maybe Text
message = Maybe Text
a} :: BatchGetVariableError)

instance Core.FromJSON BatchGetVariableError where
  parseJSON :: Value -> Parser BatchGetVariableError
parseJSON =
    String
-> (Object -> Parser BatchGetVariableError)
-> Value
-> Parser BatchGetVariableError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchGetVariableError"
      ( \Object
x ->
          Maybe Text -> Maybe Int -> Maybe Text -> BatchGetVariableError
BatchGetVariableError'
            (Maybe Text -> Maybe Int -> Maybe Text -> BatchGetVariableError)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Text -> BatchGetVariableError)
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
"name")
            Parser (Maybe Int -> Maybe Text -> BatchGetVariableError)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> BatchGetVariableError)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"code")
            Parser (Maybe Text -> BatchGetVariableError)
-> Parser (Maybe Text) -> Parser BatchGetVariableError
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
"message")
      )

instance Prelude.Hashable BatchGetVariableError

instance Prelude.NFData BatchGetVariableError