{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Inspector.Types.FailedItemDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector.Types.FailedItemErrorCode
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
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]
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
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. 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'
    { $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 :: Lens' FailedItemDetails FailedItemErrorCode
failedItemDetails_failureCode = 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 :: Lens' FailedItemDetails Bool
failedItemDetails_retryable = 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 Data.FromJSON FailedItemDetails where
  parseJSON :: Value -> Parser FailedItemDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FailedItemDetails"
      ( \Object
x ->
          FailedItemErrorCode -> Bool -> FailedItemDetails
FailedItemDetails'
            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
"failureCode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"retryable")
      )

instance Prelude.Hashable FailedItemDetails where
  hashWithSalt :: Int -> FailedItemDetails -> Int
hashWithSalt Int
_salt FailedItemDetails' {Bool
FailedItemErrorCode
retryable :: Bool
failureCode :: FailedItemErrorCode
$sel:retryable:FailedItemDetails' :: FailedItemDetails -> Bool
$sel:failureCode:FailedItemDetails' :: FailedItemDetails -> FailedItemErrorCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FailedItemErrorCode
failureCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
retryable

instance Prelude.NFData FailedItemDetails where
  rnf :: FailedItemDetails -> ()
rnf FailedItemDetails' {Bool
FailedItemErrorCode
retryable :: Bool
failureCode :: FailedItemErrorCode
$sel:retryable:FailedItemDetails' :: FailedItemDetails -> Bool
$sel:failureCode:FailedItemDetails' :: FailedItemDetails -> FailedItemErrorCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf FailedItemErrorCode
failureCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
retryable