{-# 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.IotTwinMaker.Types.BatchPutPropertyError
-- 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.IotTwinMaker.Types.BatchPutPropertyError where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types.PropertyValueEntry
import qualified Amazonka.Prelude as Prelude

-- | An error returned by the @BatchPutProperty@ action.
--
-- /See:/ 'newBatchPutPropertyError' smart constructor.
data BatchPutPropertyError = BatchPutPropertyError'
  { -- | The error code.
    BatchPutPropertyError -> Text
errorCode :: Prelude.Text,
    -- | The error message.
    BatchPutPropertyError -> Text
errorMessage :: Prelude.Text,
    -- | An object that contains information about errors returned by the
    -- @BatchPutProperty@ action.
    BatchPutPropertyError -> PropertyValueEntry
entry :: PropertyValueEntry
  }
  deriving (BatchPutPropertyError -> BatchPutPropertyError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchPutPropertyError -> BatchPutPropertyError -> Bool
$c/= :: BatchPutPropertyError -> BatchPutPropertyError -> Bool
== :: BatchPutPropertyError -> BatchPutPropertyError -> Bool
$c== :: BatchPutPropertyError -> BatchPutPropertyError -> Bool
Prelude.Eq, ReadPrec [BatchPutPropertyError]
ReadPrec BatchPutPropertyError
Int -> ReadS BatchPutPropertyError
ReadS [BatchPutPropertyError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchPutPropertyError]
$creadListPrec :: ReadPrec [BatchPutPropertyError]
readPrec :: ReadPrec BatchPutPropertyError
$creadPrec :: ReadPrec BatchPutPropertyError
readList :: ReadS [BatchPutPropertyError]
$creadList :: ReadS [BatchPutPropertyError]
readsPrec :: Int -> ReadS BatchPutPropertyError
$creadsPrec :: Int -> ReadS BatchPutPropertyError
Prelude.Read, Int -> BatchPutPropertyError -> ShowS
[BatchPutPropertyError] -> ShowS
BatchPutPropertyError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchPutPropertyError] -> ShowS
$cshowList :: [BatchPutPropertyError] -> ShowS
show :: BatchPutPropertyError -> String
$cshow :: BatchPutPropertyError -> String
showsPrec :: Int -> BatchPutPropertyError -> ShowS
$cshowsPrec :: Int -> BatchPutPropertyError -> ShowS
Prelude.Show, forall x. Rep BatchPutPropertyError x -> BatchPutPropertyError
forall x. BatchPutPropertyError -> Rep BatchPutPropertyError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchPutPropertyError x -> BatchPutPropertyError
$cfrom :: forall x. BatchPutPropertyError -> Rep BatchPutPropertyError x
Prelude.Generic)

-- |
-- Create a value of 'BatchPutPropertyError' 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', 'batchPutPropertyError_errorCode' - The error code.
--
-- 'errorMessage', 'batchPutPropertyError_errorMessage' - The error message.
--
-- 'entry', 'batchPutPropertyError_entry' - An object that contains information about errors returned by the
-- @BatchPutProperty@ action.
newBatchPutPropertyError ::
  -- | 'errorCode'
  Prelude.Text ->
  -- | 'errorMessage'
  Prelude.Text ->
  -- | 'entry'
  PropertyValueEntry ->
  BatchPutPropertyError
newBatchPutPropertyError :: Text -> Text -> PropertyValueEntry -> BatchPutPropertyError
newBatchPutPropertyError
  Text
pErrorCode_
  Text
pErrorMessage_
  PropertyValueEntry
pEntry_ =
    BatchPutPropertyError'
      { $sel:errorCode:BatchPutPropertyError' :: Text
errorCode = Text
pErrorCode_,
        $sel:errorMessage:BatchPutPropertyError' :: Text
errorMessage = Text
pErrorMessage_,
        $sel:entry:BatchPutPropertyError' :: PropertyValueEntry
entry = PropertyValueEntry
pEntry_
      }

-- | The error code.
batchPutPropertyError_errorCode :: Lens.Lens' BatchPutPropertyError Prelude.Text
batchPutPropertyError_errorCode :: Lens' BatchPutPropertyError Text
batchPutPropertyError_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutPropertyError' {Text
errorCode :: Text
$sel:errorCode:BatchPutPropertyError' :: BatchPutPropertyError -> Text
errorCode} -> Text
errorCode) (\s :: BatchPutPropertyError
s@BatchPutPropertyError' {} Text
a -> BatchPutPropertyError
s {$sel:errorCode:BatchPutPropertyError' :: Text
errorCode = Text
a} :: BatchPutPropertyError)

-- | The error message.
batchPutPropertyError_errorMessage :: Lens.Lens' BatchPutPropertyError Prelude.Text
batchPutPropertyError_errorMessage :: Lens' BatchPutPropertyError Text
batchPutPropertyError_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutPropertyError' {Text
errorMessage :: Text
$sel:errorMessage:BatchPutPropertyError' :: BatchPutPropertyError -> Text
errorMessage} -> Text
errorMessage) (\s :: BatchPutPropertyError
s@BatchPutPropertyError' {} Text
a -> BatchPutPropertyError
s {$sel:errorMessage:BatchPutPropertyError' :: Text
errorMessage = Text
a} :: BatchPutPropertyError)

-- | An object that contains information about errors returned by the
-- @BatchPutProperty@ action.
batchPutPropertyError_entry :: Lens.Lens' BatchPutPropertyError PropertyValueEntry
batchPutPropertyError_entry :: Lens' BatchPutPropertyError PropertyValueEntry
batchPutPropertyError_entry = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutPropertyError' {PropertyValueEntry
entry :: PropertyValueEntry
$sel:entry:BatchPutPropertyError' :: BatchPutPropertyError -> PropertyValueEntry
entry} -> PropertyValueEntry
entry) (\s :: BatchPutPropertyError
s@BatchPutPropertyError' {} PropertyValueEntry
a -> BatchPutPropertyError
s {$sel:entry:BatchPutPropertyError' :: PropertyValueEntry
entry = PropertyValueEntry
a} :: BatchPutPropertyError)

instance Data.FromJSON BatchPutPropertyError where
  parseJSON :: Value -> Parser BatchPutPropertyError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchPutPropertyError"
      ( \Object
x ->
          Text -> Text -> PropertyValueEntry -> BatchPutPropertyError
BatchPutPropertyError'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser 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 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 a
Data..: Key
"entry")
      )

instance Prelude.Hashable BatchPutPropertyError where
  hashWithSalt :: Int -> BatchPutPropertyError -> Int
hashWithSalt Int
_salt BatchPutPropertyError' {Text
PropertyValueEntry
entry :: PropertyValueEntry
errorMessage :: Text
errorCode :: Text
$sel:entry:BatchPutPropertyError' :: BatchPutPropertyError -> PropertyValueEntry
$sel:errorMessage:BatchPutPropertyError' :: BatchPutPropertyError -> Text
$sel:errorCode:BatchPutPropertyError' :: BatchPutPropertyError -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PropertyValueEntry
entry

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