{-# 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.CloudWatchEvents.Types.RemoveTargetsResultEntry
-- 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.CloudWatchEvents.Types.RemoveTargetsResultEntry where

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

-- | Represents a target that failed to be removed from a rule.
--
-- /See:/ 'newRemoveTargetsResultEntry' smart constructor.
data RemoveTargetsResultEntry = RemoveTargetsResultEntry'
  { -- | The ID of the target.
    RemoveTargetsResultEntry -> Maybe Text
targetId :: Prelude.Maybe Prelude.Text,
    -- | The error code that indicates why the target removal failed. If the
    -- value is @ConcurrentModificationException@, too many requests were made
    -- at the same time.
    RemoveTargetsResultEntry -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The error message that explains why the target removal failed.
    RemoveTargetsResultEntry -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (RemoveTargetsResultEntry -> RemoveTargetsResultEntry -> Bool
(RemoveTargetsResultEntry -> RemoveTargetsResultEntry -> Bool)
-> (RemoveTargetsResultEntry -> RemoveTargetsResultEntry -> Bool)
-> Eq RemoveTargetsResultEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveTargetsResultEntry -> RemoveTargetsResultEntry -> Bool
$c/= :: RemoveTargetsResultEntry -> RemoveTargetsResultEntry -> Bool
== :: RemoveTargetsResultEntry -> RemoveTargetsResultEntry -> Bool
$c== :: RemoveTargetsResultEntry -> RemoveTargetsResultEntry -> Bool
Prelude.Eq, ReadPrec [RemoveTargetsResultEntry]
ReadPrec RemoveTargetsResultEntry
Int -> ReadS RemoveTargetsResultEntry
ReadS [RemoveTargetsResultEntry]
(Int -> ReadS RemoveTargetsResultEntry)
-> ReadS [RemoveTargetsResultEntry]
-> ReadPrec RemoveTargetsResultEntry
-> ReadPrec [RemoveTargetsResultEntry]
-> Read RemoveTargetsResultEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveTargetsResultEntry]
$creadListPrec :: ReadPrec [RemoveTargetsResultEntry]
readPrec :: ReadPrec RemoveTargetsResultEntry
$creadPrec :: ReadPrec RemoveTargetsResultEntry
readList :: ReadS [RemoveTargetsResultEntry]
$creadList :: ReadS [RemoveTargetsResultEntry]
readsPrec :: Int -> ReadS RemoveTargetsResultEntry
$creadsPrec :: Int -> ReadS RemoveTargetsResultEntry
Prelude.Read, Int -> RemoveTargetsResultEntry -> ShowS
[RemoveTargetsResultEntry] -> ShowS
RemoveTargetsResultEntry -> String
(Int -> RemoveTargetsResultEntry -> ShowS)
-> (RemoveTargetsResultEntry -> String)
-> ([RemoveTargetsResultEntry] -> ShowS)
-> Show RemoveTargetsResultEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveTargetsResultEntry] -> ShowS
$cshowList :: [RemoveTargetsResultEntry] -> ShowS
show :: RemoveTargetsResultEntry -> String
$cshow :: RemoveTargetsResultEntry -> String
showsPrec :: Int -> RemoveTargetsResultEntry -> ShowS
$cshowsPrec :: Int -> RemoveTargetsResultEntry -> ShowS
Prelude.Show, (forall x.
 RemoveTargetsResultEntry -> Rep RemoveTargetsResultEntry x)
-> (forall x.
    Rep RemoveTargetsResultEntry x -> RemoveTargetsResultEntry)
-> Generic RemoveTargetsResultEntry
forall x.
Rep RemoveTargetsResultEntry x -> RemoveTargetsResultEntry
forall x.
RemoveTargetsResultEntry -> Rep RemoveTargetsResultEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveTargetsResultEntry x -> RemoveTargetsResultEntry
$cfrom :: forall x.
RemoveTargetsResultEntry -> Rep RemoveTargetsResultEntry x
Prelude.Generic)

-- |
-- Create a value of 'RemoveTargetsResultEntry' 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:
--
-- 'targetId', 'removeTargetsResultEntry_targetId' - The ID of the target.
--
-- 'errorCode', 'removeTargetsResultEntry_errorCode' - The error code that indicates why the target removal failed. If the
-- value is @ConcurrentModificationException@, too many requests were made
-- at the same time.
--
-- 'errorMessage', 'removeTargetsResultEntry_errorMessage' - The error message that explains why the target removal failed.
newRemoveTargetsResultEntry ::
  RemoveTargetsResultEntry
newRemoveTargetsResultEntry :: RemoveTargetsResultEntry
newRemoveTargetsResultEntry =
  RemoveTargetsResultEntry' :: Maybe Text -> Maybe Text -> Maybe Text -> RemoveTargetsResultEntry
RemoveTargetsResultEntry'
    { $sel:targetId:RemoveTargetsResultEntry' :: Maybe Text
targetId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:RemoveTargetsResultEntry' :: Maybe Text
errorCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:RemoveTargetsResultEntry' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the target.
removeTargetsResultEntry_targetId :: Lens.Lens' RemoveTargetsResultEntry (Prelude.Maybe Prelude.Text)
removeTargetsResultEntry_targetId :: (Maybe Text -> f (Maybe Text))
-> RemoveTargetsResultEntry -> f RemoveTargetsResultEntry
removeTargetsResultEntry_targetId = (RemoveTargetsResultEntry -> Maybe Text)
-> (RemoveTargetsResultEntry
    -> Maybe Text -> RemoveTargetsResultEntry)
-> Lens
     RemoveTargetsResultEntry
     RemoveTargetsResultEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTargetsResultEntry' {Maybe Text
targetId :: Maybe Text
$sel:targetId:RemoveTargetsResultEntry' :: RemoveTargetsResultEntry -> Maybe Text
targetId} -> Maybe Text
targetId) (\s :: RemoveTargetsResultEntry
s@RemoveTargetsResultEntry' {} Maybe Text
a -> RemoveTargetsResultEntry
s {$sel:targetId:RemoveTargetsResultEntry' :: Maybe Text
targetId = Maybe Text
a} :: RemoveTargetsResultEntry)

-- | The error code that indicates why the target removal failed. If the
-- value is @ConcurrentModificationException@, too many requests were made
-- at the same time.
removeTargetsResultEntry_errorCode :: Lens.Lens' RemoveTargetsResultEntry (Prelude.Maybe Prelude.Text)
removeTargetsResultEntry_errorCode :: (Maybe Text -> f (Maybe Text))
-> RemoveTargetsResultEntry -> f RemoveTargetsResultEntry
removeTargetsResultEntry_errorCode = (RemoveTargetsResultEntry -> Maybe Text)
-> (RemoveTargetsResultEntry
    -> Maybe Text -> RemoveTargetsResultEntry)
-> Lens
     RemoveTargetsResultEntry
     RemoveTargetsResultEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTargetsResultEntry' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:RemoveTargetsResultEntry' :: RemoveTargetsResultEntry -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: RemoveTargetsResultEntry
s@RemoveTargetsResultEntry' {} Maybe Text
a -> RemoveTargetsResultEntry
s {$sel:errorCode:RemoveTargetsResultEntry' :: Maybe Text
errorCode = Maybe Text
a} :: RemoveTargetsResultEntry)

-- | The error message that explains why the target removal failed.
removeTargetsResultEntry_errorMessage :: Lens.Lens' RemoveTargetsResultEntry (Prelude.Maybe Prelude.Text)
removeTargetsResultEntry_errorMessage :: (Maybe Text -> f (Maybe Text))
-> RemoveTargetsResultEntry -> f RemoveTargetsResultEntry
removeTargetsResultEntry_errorMessage = (RemoveTargetsResultEntry -> Maybe Text)
-> (RemoveTargetsResultEntry
    -> Maybe Text -> RemoveTargetsResultEntry)
-> Lens
     RemoveTargetsResultEntry
     RemoveTargetsResultEntry
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTargetsResultEntry' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:RemoveTargetsResultEntry' :: RemoveTargetsResultEntry -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: RemoveTargetsResultEntry
s@RemoveTargetsResultEntry' {} Maybe Text
a -> RemoveTargetsResultEntry
s {$sel:errorMessage:RemoveTargetsResultEntry' :: Maybe Text
errorMessage = Maybe Text
a} :: RemoveTargetsResultEntry)

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

instance Prelude.Hashable RemoveTargetsResultEntry

instance Prelude.NFData RemoveTargetsResultEntry