{-# 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.Inspector.Types.FailedItemDetails
-- 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.Inspector.Types.FailedItemDetails where

import qualified Amazonka.Core as Core
import Amazonka.Inspector.Types.FailedItemErrorCode
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Includes details about the failed items.
--
-- /See:/ 'newFailedItemDetails' smart constructor.
data FailedItemDetails = FailedItemDetails'
  { -- | The status code of a failed item.
    FailedItemDetails -> FailedItemErrorCode
failureCode :: FailedItemErrorCode,
    -- | Indicates whether you can immediately retry a request for this item for
    -- a specified resource.
    FailedItemDetails -> Bool
retryable :: Prelude.Bool
  }
  deriving (FailedItemDetails -> FailedItemDetails -> Bool
(FailedItemDetails -> FailedItemDetails -> Bool)
-> (FailedItemDetails -> FailedItemDetails -> Bool)
-> Eq FailedItemDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailedItemDetails -> FailedItemDetails -> Bool
$c/= :: FailedItemDetails -> FailedItemDetails -> Bool
== :: FailedItemDetails -> FailedItemDetails -> Bool
$c== :: FailedItemDetails -> FailedItemDetails -> Bool
Prelude.Eq, ReadPrec [FailedItemDetails]
ReadPrec FailedItemDetails
Int -> ReadS FailedItemDetails
ReadS [FailedItemDetails]
(Int -> ReadS FailedItemDetails)
-> ReadS [FailedItemDetails]
-> ReadPrec FailedItemDetails
-> ReadPrec [FailedItemDetails]
-> Read FailedItemDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailedItemDetails]
$creadListPrec :: ReadPrec [FailedItemDetails]
readPrec :: ReadPrec FailedItemDetails
$creadPrec :: ReadPrec FailedItemDetails
readList :: ReadS [FailedItemDetails]
$creadList :: ReadS [FailedItemDetails]
readsPrec :: Int -> ReadS FailedItemDetails
$creadsPrec :: Int -> ReadS FailedItemDetails
Prelude.Read, Int -> FailedItemDetails -> ShowS
[FailedItemDetails] -> ShowS
FailedItemDetails -> String
(Int -> FailedItemDetails -> ShowS)
-> (FailedItemDetails -> String)
-> ([FailedItemDetails] -> ShowS)
-> Show FailedItemDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailedItemDetails] -> ShowS
$cshowList :: [FailedItemDetails] -> ShowS
show :: FailedItemDetails -> String
$cshow :: FailedItemDetails -> String
showsPrec :: Int -> FailedItemDetails -> ShowS
$cshowsPrec :: Int -> FailedItemDetails -> ShowS
Prelude.Show, (forall x. FailedItemDetails -> Rep FailedItemDetails x)
-> (forall x. Rep FailedItemDetails x -> FailedItemDetails)
-> Generic FailedItemDetails
forall x. Rep FailedItemDetails x -> FailedItemDetails
forall x. FailedItemDetails -> Rep FailedItemDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FailedItemDetails x -> FailedItemDetails
$cfrom :: forall x. FailedItemDetails -> Rep FailedItemDetails x
Prelude.Generic)

-- |
-- Create a value of 'FailedItemDetails' 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:
--
-- 'failureCode', 'failedItemDetails_failureCode' - The status code of a failed item.
--
-- 'retryable', 'failedItemDetails_retryable' - Indicates whether you can immediately retry a request for this item for
-- a specified resource.
newFailedItemDetails ::
  -- | 'failureCode'
  FailedItemErrorCode ->
  -- | 'retryable'
  Prelude.Bool ->
  FailedItemDetails
newFailedItemDetails :: FailedItemErrorCode -> Bool -> FailedItemDetails
newFailedItemDetails FailedItemErrorCode
pFailureCode_ Bool
pRetryable_ =
  FailedItemDetails' :: FailedItemErrorCode -> Bool -> FailedItemDetails
FailedItemDetails'
    { $sel:failureCode:FailedItemDetails' :: FailedItemErrorCode
failureCode = FailedItemErrorCode
pFailureCode_,
      $sel:retryable:FailedItemDetails' :: Bool
retryable = Bool
pRetryable_
    }

-- | The status code of a failed item.
failedItemDetails_failureCode :: Lens.Lens' FailedItemDetails FailedItemErrorCode
failedItemDetails_failureCode :: (FailedItemErrorCode -> f FailedItemErrorCode)
-> FailedItemDetails -> f FailedItemDetails
failedItemDetails_failureCode = (FailedItemDetails -> FailedItemErrorCode)
-> (FailedItemDetails -> FailedItemErrorCode -> FailedItemDetails)
-> Lens
     FailedItemDetails
     FailedItemDetails
     FailedItemErrorCode
     FailedItemErrorCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedItemDetails' {FailedItemErrorCode
failureCode :: FailedItemErrorCode
$sel:failureCode:FailedItemDetails' :: FailedItemDetails -> FailedItemErrorCode
failureCode} -> FailedItemErrorCode
failureCode) (\s :: FailedItemDetails
s@FailedItemDetails' {} FailedItemErrorCode
a -> FailedItemDetails
s {$sel:failureCode:FailedItemDetails' :: FailedItemErrorCode
failureCode = FailedItemErrorCode
a} :: FailedItemDetails)

-- | Indicates whether you can immediately retry a request for this item for
-- a specified resource.
failedItemDetails_retryable :: Lens.Lens' FailedItemDetails Prelude.Bool
failedItemDetails_retryable :: (Bool -> f Bool) -> FailedItemDetails -> f FailedItemDetails
failedItemDetails_retryable = (FailedItemDetails -> Bool)
-> (FailedItemDetails -> Bool -> FailedItemDetails)
-> Lens FailedItemDetails FailedItemDetails Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedItemDetails' {Bool
retryable :: Bool
$sel:retryable:FailedItemDetails' :: FailedItemDetails -> Bool
retryable} -> Bool
retryable) (\s :: FailedItemDetails
s@FailedItemDetails' {} Bool
a -> FailedItemDetails
s {$sel:retryable:FailedItemDetails' :: Bool
retryable = Bool
a} :: FailedItemDetails)

instance Core.FromJSON FailedItemDetails where
  parseJSON :: Value -> Parser FailedItemDetails
parseJSON =
    String
-> (Object -> Parser FailedItemDetails)
-> Value
-> Parser FailedItemDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FailedItemDetails"
      ( \Object
x ->
          FailedItemErrorCode -> Bool -> FailedItemDetails
FailedItemDetails'
            (FailedItemErrorCode -> Bool -> FailedItemDetails)
-> Parser FailedItemErrorCode -> Parser (Bool -> FailedItemDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser FailedItemErrorCode
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"failureCode")
            Parser (Bool -> FailedItemDetails)
-> Parser Bool -> Parser FailedItemDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"retryable")
      )

instance Prelude.Hashable FailedItemDetails

instance Prelude.NFData FailedItemDetails