{-# 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.IoTSiteWise.Types.BatchPutAssetPropertyErrorEntry
-- 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.IoTSiteWise.Types.BatchPutAssetPropertyErrorEntry where

import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.BatchPutAssetPropertyError
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains error information for asset property value entries that are
-- associated with the
-- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_BatchPutAssetPropertyValue.html BatchPutAssetPropertyValue>
-- API.
--
-- /See:/ 'newBatchPutAssetPropertyErrorEntry' smart constructor.
data BatchPutAssetPropertyErrorEntry = BatchPutAssetPropertyErrorEntry'
  { -- | The ID of the failed entry.
    BatchPutAssetPropertyErrorEntry -> Text
entryId :: Prelude.Text,
    -- | The list of update property value errors.
    BatchPutAssetPropertyErrorEntry -> [BatchPutAssetPropertyError]
errors :: [BatchPutAssetPropertyError]
  }
  deriving (BatchPutAssetPropertyErrorEntry
-> BatchPutAssetPropertyErrorEntry -> Bool
(BatchPutAssetPropertyErrorEntry
 -> BatchPutAssetPropertyErrorEntry -> Bool)
-> (BatchPutAssetPropertyErrorEntry
    -> BatchPutAssetPropertyErrorEntry -> Bool)
-> Eq BatchPutAssetPropertyErrorEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchPutAssetPropertyErrorEntry
-> BatchPutAssetPropertyErrorEntry -> Bool
$c/= :: BatchPutAssetPropertyErrorEntry
-> BatchPutAssetPropertyErrorEntry -> Bool
== :: BatchPutAssetPropertyErrorEntry
-> BatchPutAssetPropertyErrorEntry -> Bool
$c== :: BatchPutAssetPropertyErrorEntry
-> BatchPutAssetPropertyErrorEntry -> Bool
Prelude.Eq, ReadPrec [BatchPutAssetPropertyErrorEntry]
ReadPrec BatchPutAssetPropertyErrorEntry
Int -> ReadS BatchPutAssetPropertyErrorEntry
ReadS [BatchPutAssetPropertyErrorEntry]
(Int -> ReadS BatchPutAssetPropertyErrorEntry)
-> ReadS [BatchPutAssetPropertyErrorEntry]
-> ReadPrec BatchPutAssetPropertyErrorEntry
-> ReadPrec [BatchPutAssetPropertyErrorEntry]
-> Read BatchPutAssetPropertyErrorEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchPutAssetPropertyErrorEntry]
$creadListPrec :: ReadPrec [BatchPutAssetPropertyErrorEntry]
readPrec :: ReadPrec BatchPutAssetPropertyErrorEntry
$creadPrec :: ReadPrec BatchPutAssetPropertyErrorEntry
readList :: ReadS [BatchPutAssetPropertyErrorEntry]
$creadList :: ReadS [BatchPutAssetPropertyErrorEntry]
readsPrec :: Int -> ReadS BatchPutAssetPropertyErrorEntry
$creadsPrec :: Int -> ReadS BatchPutAssetPropertyErrorEntry
Prelude.Read, Int -> BatchPutAssetPropertyErrorEntry -> ShowS
[BatchPutAssetPropertyErrorEntry] -> ShowS
BatchPutAssetPropertyErrorEntry -> String
(Int -> BatchPutAssetPropertyErrorEntry -> ShowS)
-> (BatchPutAssetPropertyErrorEntry -> String)
-> ([BatchPutAssetPropertyErrorEntry] -> ShowS)
-> Show BatchPutAssetPropertyErrorEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchPutAssetPropertyErrorEntry] -> ShowS
$cshowList :: [BatchPutAssetPropertyErrorEntry] -> ShowS
show :: BatchPutAssetPropertyErrorEntry -> String
$cshow :: BatchPutAssetPropertyErrorEntry -> String
showsPrec :: Int -> BatchPutAssetPropertyErrorEntry -> ShowS
$cshowsPrec :: Int -> BatchPutAssetPropertyErrorEntry -> ShowS
Prelude.Show, (forall x.
 BatchPutAssetPropertyErrorEntry
 -> Rep BatchPutAssetPropertyErrorEntry x)
-> (forall x.
    Rep BatchPutAssetPropertyErrorEntry x
    -> BatchPutAssetPropertyErrorEntry)
-> Generic BatchPutAssetPropertyErrorEntry
forall x.
Rep BatchPutAssetPropertyErrorEntry x
-> BatchPutAssetPropertyErrorEntry
forall x.
BatchPutAssetPropertyErrorEntry
-> Rep BatchPutAssetPropertyErrorEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchPutAssetPropertyErrorEntry x
-> BatchPutAssetPropertyErrorEntry
$cfrom :: forall x.
BatchPutAssetPropertyErrorEntry
-> Rep BatchPutAssetPropertyErrorEntry x
Prelude.Generic)

-- |
-- Create a value of 'BatchPutAssetPropertyErrorEntry' 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:
--
-- 'entryId', 'batchPutAssetPropertyErrorEntry_entryId' - The ID of the failed entry.
--
-- 'errors', 'batchPutAssetPropertyErrorEntry_errors' - The list of update property value errors.
newBatchPutAssetPropertyErrorEntry ::
  -- | 'entryId'
  Prelude.Text ->
  BatchPutAssetPropertyErrorEntry
newBatchPutAssetPropertyErrorEntry :: Text -> BatchPutAssetPropertyErrorEntry
newBatchPutAssetPropertyErrorEntry Text
pEntryId_ =
  BatchPutAssetPropertyErrorEntry' :: Text
-> [BatchPutAssetPropertyError] -> BatchPutAssetPropertyErrorEntry
BatchPutAssetPropertyErrorEntry'
    { $sel:entryId:BatchPutAssetPropertyErrorEntry' :: Text
entryId =
        Text
pEntryId_,
      $sel:errors:BatchPutAssetPropertyErrorEntry' :: [BatchPutAssetPropertyError]
errors = [BatchPutAssetPropertyError]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The ID of the failed entry.
batchPutAssetPropertyErrorEntry_entryId :: Lens.Lens' BatchPutAssetPropertyErrorEntry Prelude.Text
batchPutAssetPropertyErrorEntry_entryId :: (Text -> f Text)
-> BatchPutAssetPropertyErrorEntry
-> f BatchPutAssetPropertyErrorEntry
batchPutAssetPropertyErrorEntry_entryId = (BatchPutAssetPropertyErrorEntry -> Text)
-> (BatchPutAssetPropertyErrorEntry
    -> Text -> BatchPutAssetPropertyErrorEntry)
-> Lens
     BatchPutAssetPropertyErrorEntry
     BatchPutAssetPropertyErrorEntry
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutAssetPropertyErrorEntry' {Text
entryId :: Text
$sel:entryId:BatchPutAssetPropertyErrorEntry' :: BatchPutAssetPropertyErrorEntry -> Text
entryId} -> Text
entryId) (\s :: BatchPutAssetPropertyErrorEntry
s@BatchPutAssetPropertyErrorEntry' {} Text
a -> BatchPutAssetPropertyErrorEntry
s {$sel:entryId:BatchPutAssetPropertyErrorEntry' :: Text
entryId = Text
a} :: BatchPutAssetPropertyErrorEntry)

-- | The list of update property value errors.
batchPutAssetPropertyErrorEntry_errors :: Lens.Lens' BatchPutAssetPropertyErrorEntry [BatchPutAssetPropertyError]
batchPutAssetPropertyErrorEntry_errors :: ([BatchPutAssetPropertyError] -> f [BatchPutAssetPropertyError])
-> BatchPutAssetPropertyErrorEntry
-> f BatchPutAssetPropertyErrorEntry
batchPutAssetPropertyErrorEntry_errors = (BatchPutAssetPropertyErrorEntry -> [BatchPutAssetPropertyError])
-> (BatchPutAssetPropertyErrorEntry
    -> [BatchPutAssetPropertyError] -> BatchPutAssetPropertyErrorEntry)
-> Lens
     BatchPutAssetPropertyErrorEntry
     BatchPutAssetPropertyErrorEntry
     [BatchPutAssetPropertyError]
     [BatchPutAssetPropertyError]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchPutAssetPropertyErrorEntry' {[BatchPutAssetPropertyError]
errors :: [BatchPutAssetPropertyError]
$sel:errors:BatchPutAssetPropertyErrorEntry' :: BatchPutAssetPropertyErrorEntry -> [BatchPutAssetPropertyError]
errors} -> [BatchPutAssetPropertyError]
errors) (\s :: BatchPutAssetPropertyErrorEntry
s@BatchPutAssetPropertyErrorEntry' {} [BatchPutAssetPropertyError]
a -> BatchPutAssetPropertyErrorEntry
s {$sel:errors:BatchPutAssetPropertyErrorEntry' :: [BatchPutAssetPropertyError]
errors = [BatchPutAssetPropertyError]
a} :: BatchPutAssetPropertyErrorEntry) (([BatchPutAssetPropertyError] -> f [BatchPutAssetPropertyError])
 -> BatchPutAssetPropertyErrorEntry
 -> f BatchPutAssetPropertyErrorEntry)
-> (([BatchPutAssetPropertyError]
     -> f [BatchPutAssetPropertyError])
    -> [BatchPutAssetPropertyError] -> f [BatchPutAssetPropertyError])
-> ([BatchPutAssetPropertyError] -> f [BatchPutAssetPropertyError])
-> BatchPutAssetPropertyErrorEntry
-> f BatchPutAssetPropertyErrorEntry
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BatchPutAssetPropertyError] -> f [BatchPutAssetPropertyError])
-> [BatchPutAssetPropertyError] -> f [BatchPutAssetPropertyError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    BatchPutAssetPropertyErrorEntry
  where
  parseJSON :: Value -> Parser BatchPutAssetPropertyErrorEntry
parseJSON =
    String
-> (Object -> Parser BatchPutAssetPropertyErrorEntry)
-> Value
-> Parser BatchPutAssetPropertyErrorEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchPutAssetPropertyErrorEntry"
      ( \Object
x ->
          Text
-> [BatchPutAssetPropertyError] -> BatchPutAssetPropertyErrorEntry
BatchPutAssetPropertyErrorEntry'
            (Text
 -> [BatchPutAssetPropertyError] -> BatchPutAssetPropertyErrorEntry)
-> Parser Text
-> Parser
     ([BatchPutAssetPropertyError] -> BatchPutAssetPropertyErrorEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"entryId")
            Parser
  ([BatchPutAssetPropertyError] -> BatchPutAssetPropertyErrorEntry)
-> Parser [BatchPutAssetPropertyError]
-> Parser BatchPutAssetPropertyErrorEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [BatchPutAssetPropertyError])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"errors" Parser (Maybe [BatchPutAssetPropertyError])
-> [BatchPutAssetPropertyError]
-> Parser [BatchPutAssetPropertyError]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [BatchPutAssetPropertyError]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    BatchPutAssetPropertyErrorEntry

instance
  Prelude.NFData
    BatchPutAssetPropertyErrorEntry