{-# 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.GreengrassV2.Types.AssociateClientDeviceWithCoreDeviceErrorEntry
-- 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.GreengrassV2.Types.AssociateClientDeviceWithCoreDeviceErrorEntry where

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

-- | Contains an error that occurs from a request to associate a client
-- device with a core device. The
-- <https://docs.aws.amazon.com/greengrass/v2/APIReference/API_BatchAssociateClientDeviceWithCoreDevice.html BatchAssociateClientDeviceWithCoreDevice>
-- operation returns a list of these errors.
--
-- /See:/ 'newAssociateClientDeviceWithCoreDeviceErrorEntry' smart constructor.
data AssociateClientDeviceWithCoreDeviceErrorEntry = AssociateClientDeviceWithCoreDeviceErrorEntry'
  { -- | The error code for the request.
    AssociateClientDeviceWithCoreDeviceErrorEntry -> Maybe Text
code :: Prelude.Maybe Prelude.Text,
    -- | A message that provides additional information about the error.
    AssociateClientDeviceWithCoreDeviceErrorEntry -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The name of the IoT thing whose associate request failed.
    AssociateClientDeviceWithCoreDeviceErrorEntry -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text
  }
  deriving (AssociateClientDeviceWithCoreDeviceErrorEntry
-> AssociateClientDeviceWithCoreDeviceErrorEntry -> Bool
(AssociateClientDeviceWithCoreDeviceErrorEntry
 -> AssociateClientDeviceWithCoreDeviceErrorEntry -> Bool)
-> (AssociateClientDeviceWithCoreDeviceErrorEntry
    -> AssociateClientDeviceWithCoreDeviceErrorEntry -> Bool)
-> Eq AssociateClientDeviceWithCoreDeviceErrorEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateClientDeviceWithCoreDeviceErrorEntry
-> AssociateClientDeviceWithCoreDeviceErrorEntry -> Bool
$c/= :: AssociateClientDeviceWithCoreDeviceErrorEntry
-> AssociateClientDeviceWithCoreDeviceErrorEntry -> Bool
== :: AssociateClientDeviceWithCoreDeviceErrorEntry
-> AssociateClientDeviceWithCoreDeviceErrorEntry -> Bool
$c== :: AssociateClientDeviceWithCoreDeviceErrorEntry
-> AssociateClientDeviceWithCoreDeviceErrorEntry -> Bool
Prelude.Eq, ReadPrec [AssociateClientDeviceWithCoreDeviceErrorEntry]
ReadPrec AssociateClientDeviceWithCoreDeviceErrorEntry
Int -> ReadS AssociateClientDeviceWithCoreDeviceErrorEntry
ReadS [AssociateClientDeviceWithCoreDeviceErrorEntry]
(Int -> ReadS AssociateClientDeviceWithCoreDeviceErrorEntry)
-> ReadS [AssociateClientDeviceWithCoreDeviceErrorEntry]
-> ReadPrec AssociateClientDeviceWithCoreDeviceErrorEntry
-> ReadPrec [AssociateClientDeviceWithCoreDeviceErrorEntry]
-> Read AssociateClientDeviceWithCoreDeviceErrorEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateClientDeviceWithCoreDeviceErrorEntry]
$creadListPrec :: ReadPrec [AssociateClientDeviceWithCoreDeviceErrorEntry]
readPrec :: ReadPrec AssociateClientDeviceWithCoreDeviceErrorEntry
$creadPrec :: ReadPrec AssociateClientDeviceWithCoreDeviceErrorEntry
readList :: ReadS [AssociateClientDeviceWithCoreDeviceErrorEntry]
$creadList :: ReadS [AssociateClientDeviceWithCoreDeviceErrorEntry]
readsPrec :: Int -> ReadS AssociateClientDeviceWithCoreDeviceErrorEntry
$creadsPrec :: Int -> ReadS AssociateClientDeviceWithCoreDeviceErrorEntry
Prelude.Read, Int -> AssociateClientDeviceWithCoreDeviceErrorEntry -> ShowS
[AssociateClientDeviceWithCoreDeviceErrorEntry] -> ShowS
AssociateClientDeviceWithCoreDeviceErrorEntry -> String
(Int -> AssociateClientDeviceWithCoreDeviceErrorEntry -> ShowS)
-> (AssociateClientDeviceWithCoreDeviceErrorEntry -> String)
-> ([AssociateClientDeviceWithCoreDeviceErrorEntry] -> ShowS)
-> Show AssociateClientDeviceWithCoreDeviceErrorEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateClientDeviceWithCoreDeviceErrorEntry] -> ShowS
$cshowList :: [AssociateClientDeviceWithCoreDeviceErrorEntry] -> ShowS
show :: AssociateClientDeviceWithCoreDeviceErrorEntry -> String
$cshow :: AssociateClientDeviceWithCoreDeviceErrorEntry -> String
showsPrec :: Int -> AssociateClientDeviceWithCoreDeviceErrorEntry -> ShowS
$cshowsPrec :: Int -> AssociateClientDeviceWithCoreDeviceErrorEntry -> ShowS
Prelude.Show, (forall x.
 AssociateClientDeviceWithCoreDeviceErrorEntry
 -> Rep AssociateClientDeviceWithCoreDeviceErrorEntry x)
-> (forall x.
    Rep AssociateClientDeviceWithCoreDeviceErrorEntry x
    -> AssociateClientDeviceWithCoreDeviceErrorEntry)
-> Generic AssociateClientDeviceWithCoreDeviceErrorEntry
forall x.
Rep AssociateClientDeviceWithCoreDeviceErrorEntry x
-> AssociateClientDeviceWithCoreDeviceErrorEntry
forall x.
AssociateClientDeviceWithCoreDeviceErrorEntry
-> Rep AssociateClientDeviceWithCoreDeviceErrorEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateClientDeviceWithCoreDeviceErrorEntry x
-> AssociateClientDeviceWithCoreDeviceErrorEntry
$cfrom :: forall x.
AssociateClientDeviceWithCoreDeviceErrorEntry
-> Rep AssociateClientDeviceWithCoreDeviceErrorEntry x
Prelude.Generic)

-- |
-- Create a value of 'AssociateClientDeviceWithCoreDeviceErrorEntry' 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:
--
-- 'code', 'associateClientDeviceWithCoreDeviceErrorEntry_code' - The error code for the request.
--
-- 'message', 'associateClientDeviceWithCoreDeviceErrorEntry_message' - A message that provides additional information about the error.
--
-- 'thingName', 'associateClientDeviceWithCoreDeviceErrorEntry_thingName' - The name of the IoT thing whose associate request failed.
newAssociateClientDeviceWithCoreDeviceErrorEntry ::
  AssociateClientDeviceWithCoreDeviceErrorEntry
newAssociateClientDeviceWithCoreDeviceErrorEntry :: AssociateClientDeviceWithCoreDeviceErrorEntry
newAssociateClientDeviceWithCoreDeviceErrorEntry =
  AssociateClientDeviceWithCoreDeviceErrorEntry' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> AssociateClientDeviceWithCoreDeviceErrorEntry
AssociateClientDeviceWithCoreDeviceErrorEntry'
    { $sel:code:AssociateClientDeviceWithCoreDeviceErrorEntry' :: Maybe Text
code =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:AssociateClientDeviceWithCoreDeviceErrorEntry' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:thingName:AssociateClientDeviceWithCoreDeviceErrorEntry' :: Maybe Text
thingName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The error code for the request.
associateClientDeviceWithCoreDeviceErrorEntry_code :: Lens.Lens' AssociateClientDeviceWithCoreDeviceErrorEntry (Prelude.Maybe Prelude.Text)
associateClientDeviceWithCoreDeviceErrorEntry_code :: (Maybe Text -> f (Maybe Text))
-> AssociateClientDeviceWithCoreDeviceErrorEntry
-> f AssociateClientDeviceWithCoreDeviceErrorEntry
associateClientDeviceWithCoreDeviceErrorEntry_code = (AssociateClientDeviceWithCoreDeviceErrorEntry -> Maybe Text)
-> (AssociateClientDeviceWithCoreDeviceErrorEntry
    -> Maybe Text -> AssociateClientDeviceWithCoreDeviceErrorEntry)
-> Lens
     AssociateClientDeviceWithCoreDeviceErrorEntry
     AssociateClientDeviceWithCoreDeviceErrorEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateClientDeviceWithCoreDeviceErrorEntry' {Maybe Text
code :: Maybe Text
$sel:code:AssociateClientDeviceWithCoreDeviceErrorEntry' :: AssociateClientDeviceWithCoreDeviceErrorEntry -> Maybe Text
code} -> Maybe Text
code) (\s :: AssociateClientDeviceWithCoreDeviceErrorEntry
s@AssociateClientDeviceWithCoreDeviceErrorEntry' {} Maybe Text
a -> AssociateClientDeviceWithCoreDeviceErrorEntry
s {$sel:code:AssociateClientDeviceWithCoreDeviceErrorEntry' :: Maybe Text
code = Maybe Text
a} :: AssociateClientDeviceWithCoreDeviceErrorEntry)

-- | A message that provides additional information about the error.
associateClientDeviceWithCoreDeviceErrorEntry_message :: Lens.Lens' AssociateClientDeviceWithCoreDeviceErrorEntry (Prelude.Maybe Prelude.Text)
associateClientDeviceWithCoreDeviceErrorEntry_message :: (Maybe Text -> f (Maybe Text))
-> AssociateClientDeviceWithCoreDeviceErrorEntry
-> f AssociateClientDeviceWithCoreDeviceErrorEntry
associateClientDeviceWithCoreDeviceErrorEntry_message = (AssociateClientDeviceWithCoreDeviceErrorEntry -> Maybe Text)
-> (AssociateClientDeviceWithCoreDeviceErrorEntry
    -> Maybe Text -> AssociateClientDeviceWithCoreDeviceErrorEntry)
-> Lens
     AssociateClientDeviceWithCoreDeviceErrorEntry
     AssociateClientDeviceWithCoreDeviceErrorEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateClientDeviceWithCoreDeviceErrorEntry' {Maybe Text
message :: Maybe Text
$sel:message:AssociateClientDeviceWithCoreDeviceErrorEntry' :: AssociateClientDeviceWithCoreDeviceErrorEntry -> Maybe Text
message} -> Maybe Text
message) (\s :: AssociateClientDeviceWithCoreDeviceErrorEntry
s@AssociateClientDeviceWithCoreDeviceErrorEntry' {} Maybe Text
a -> AssociateClientDeviceWithCoreDeviceErrorEntry
s {$sel:message:AssociateClientDeviceWithCoreDeviceErrorEntry' :: Maybe Text
message = Maybe Text
a} :: AssociateClientDeviceWithCoreDeviceErrorEntry)

-- | The name of the IoT thing whose associate request failed.
associateClientDeviceWithCoreDeviceErrorEntry_thingName :: Lens.Lens' AssociateClientDeviceWithCoreDeviceErrorEntry (Prelude.Maybe Prelude.Text)
associateClientDeviceWithCoreDeviceErrorEntry_thingName :: (Maybe Text -> f (Maybe Text))
-> AssociateClientDeviceWithCoreDeviceErrorEntry
-> f AssociateClientDeviceWithCoreDeviceErrorEntry
associateClientDeviceWithCoreDeviceErrorEntry_thingName = (AssociateClientDeviceWithCoreDeviceErrorEntry -> Maybe Text)
-> (AssociateClientDeviceWithCoreDeviceErrorEntry
    -> Maybe Text -> AssociateClientDeviceWithCoreDeviceErrorEntry)
-> Lens
     AssociateClientDeviceWithCoreDeviceErrorEntry
     AssociateClientDeviceWithCoreDeviceErrorEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateClientDeviceWithCoreDeviceErrorEntry' {Maybe Text
thingName :: Maybe Text
$sel:thingName:AssociateClientDeviceWithCoreDeviceErrorEntry' :: AssociateClientDeviceWithCoreDeviceErrorEntry -> Maybe Text
thingName} -> Maybe Text
thingName) (\s :: AssociateClientDeviceWithCoreDeviceErrorEntry
s@AssociateClientDeviceWithCoreDeviceErrorEntry' {} Maybe Text
a -> AssociateClientDeviceWithCoreDeviceErrorEntry
s {$sel:thingName:AssociateClientDeviceWithCoreDeviceErrorEntry' :: Maybe Text
thingName = Maybe Text
a} :: AssociateClientDeviceWithCoreDeviceErrorEntry)

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

instance
  Prelude.Hashable
    AssociateClientDeviceWithCoreDeviceErrorEntry

instance
  Prelude.NFData
    AssociateClientDeviceWithCoreDeviceErrorEntry