{-# 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.BatchPutPropertyErrorEntry
-- 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.BatchPutPropertyErrorEntry 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.BatchPutPropertyError
import qualified Amazonka.Prelude as Prelude

-- | An object that contains information about errors returned by the
-- @BatchPutProperty@ action.
--
-- /See:/ 'newBatchPutPropertyErrorEntry' smart constructor.
data BatchPutPropertyErrorEntry = BatchPutPropertyErrorEntry'
  { -- | A list of objects that contain information about errors returned by the
    -- @BatchPutProperty@ action.
    BatchPutPropertyErrorEntry -> NonEmpty BatchPutPropertyError
errors :: Prelude.NonEmpty BatchPutPropertyError
  }
  deriving (BatchPutPropertyErrorEntry -> BatchPutPropertyErrorEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchPutPropertyErrorEntry -> BatchPutPropertyErrorEntry -> Bool
$c/= :: BatchPutPropertyErrorEntry -> BatchPutPropertyErrorEntry -> Bool
== :: BatchPutPropertyErrorEntry -> BatchPutPropertyErrorEntry -> Bool
$c== :: BatchPutPropertyErrorEntry -> BatchPutPropertyErrorEntry -> Bool
Prelude.Eq, ReadPrec [BatchPutPropertyErrorEntry]
ReadPrec BatchPutPropertyErrorEntry
Int -> ReadS BatchPutPropertyErrorEntry
ReadS [BatchPutPropertyErrorEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchPutPropertyErrorEntry]
$creadListPrec :: ReadPrec [BatchPutPropertyErrorEntry]
readPrec :: ReadPrec BatchPutPropertyErrorEntry
$creadPrec :: ReadPrec BatchPutPropertyErrorEntry
readList :: ReadS [BatchPutPropertyErrorEntry]
$creadList :: ReadS [BatchPutPropertyErrorEntry]
readsPrec :: Int -> ReadS BatchPutPropertyErrorEntry
$creadsPrec :: Int -> ReadS BatchPutPropertyErrorEntry
Prelude.Read, Int -> BatchPutPropertyErrorEntry -> ShowS
[BatchPutPropertyErrorEntry] -> ShowS
BatchPutPropertyErrorEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchPutPropertyErrorEntry] -> ShowS
$cshowList :: [BatchPutPropertyErrorEntry] -> ShowS
show :: BatchPutPropertyErrorEntry -> String
$cshow :: BatchPutPropertyErrorEntry -> String
showsPrec :: Int -> BatchPutPropertyErrorEntry -> ShowS
$cshowsPrec :: Int -> BatchPutPropertyErrorEntry -> ShowS
Prelude.Show, forall x.
Rep BatchPutPropertyErrorEntry x -> BatchPutPropertyErrorEntry
forall x.
BatchPutPropertyErrorEntry -> Rep BatchPutPropertyErrorEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchPutPropertyErrorEntry x -> BatchPutPropertyErrorEntry
$cfrom :: forall x.
BatchPutPropertyErrorEntry -> Rep BatchPutPropertyErrorEntry x
Prelude.Generic)

-- |
-- Create a value of 'BatchPutPropertyErrorEntry' 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:
--
-- 'errors', 'batchPutPropertyErrorEntry_errors' - A list of objects that contain information about errors returned by the
-- @BatchPutProperty@ action.
newBatchPutPropertyErrorEntry ::
  -- | 'errors'
  Prelude.NonEmpty BatchPutPropertyError ->
  BatchPutPropertyErrorEntry
newBatchPutPropertyErrorEntry :: NonEmpty BatchPutPropertyError -> BatchPutPropertyErrorEntry
newBatchPutPropertyErrorEntry NonEmpty BatchPutPropertyError
pErrors_ =
  BatchPutPropertyErrorEntry'
    { $sel:errors:BatchPutPropertyErrorEntry' :: NonEmpty BatchPutPropertyError
errors =
        forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty BatchPutPropertyError
pErrors_
    }

-- | A list of objects that contain information about errors returned by the
-- @BatchPutProperty@ action.
batchPutPropertyErrorEntry_errors :: Lens.Lens' BatchPutPropertyErrorEntry (Prelude.NonEmpty BatchPutPropertyError)
batchPutPropertyErrorEntry_errors :: Lens' BatchPutPropertyErrorEntry (NonEmpty BatchPutPropertyError)
batchPutPropertyErrorEntry_errors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutPropertyErrorEntry' {NonEmpty BatchPutPropertyError
errors :: NonEmpty BatchPutPropertyError
$sel:errors:BatchPutPropertyErrorEntry' :: BatchPutPropertyErrorEntry -> NonEmpty BatchPutPropertyError
errors} -> NonEmpty BatchPutPropertyError
errors) (\s :: BatchPutPropertyErrorEntry
s@BatchPutPropertyErrorEntry' {} NonEmpty BatchPutPropertyError
a -> BatchPutPropertyErrorEntry
s {$sel:errors:BatchPutPropertyErrorEntry' :: NonEmpty BatchPutPropertyError
errors = NonEmpty BatchPutPropertyError
a} :: BatchPutPropertyErrorEntry) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON BatchPutPropertyErrorEntry where
  parseJSON :: Value -> Parser BatchPutPropertyErrorEntry
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchPutPropertyErrorEntry"
      ( \Object
x ->
          NonEmpty BatchPutPropertyError -> BatchPutPropertyErrorEntry
BatchPutPropertyErrorEntry'
            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
"errors")
      )

instance Prelude.Hashable BatchPutPropertyErrorEntry where
  hashWithSalt :: Int -> BatchPutPropertyErrorEntry -> Int
hashWithSalt Int
_salt BatchPutPropertyErrorEntry' {NonEmpty BatchPutPropertyError
errors :: NonEmpty BatchPutPropertyError
$sel:errors:BatchPutPropertyErrorEntry' :: BatchPutPropertyErrorEntry -> NonEmpty BatchPutPropertyError
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty BatchPutPropertyError
errors

instance Prelude.NFData BatchPutPropertyErrorEntry where
  rnf :: BatchPutPropertyErrorEntry -> ()
rnf BatchPutPropertyErrorEntry' {NonEmpty BatchPutPropertyError
errors :: NonEmpty BatchPutPropertyError
$sel:errors:BatchPutPropertyErrorEntry' :: BatchPutPropertyErrorEntry -> NonEmpty BatchPutPropertyError
..} =
    forall a. NFData a => a -> ()
Prelude.rnf NonEmpty BatchPutPropertyError
errors