{-# 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.Macie.Types.FailedS3Resource
-- 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.Macie.Types.FailedS3Resource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Macie.Types.S3Resource
import qualified Amazonka.Prelude as Prelude

-- | (Discontinued) Includes details about the failed S3 resources.
--
-- /See:/ 'newFailedS3Resource' smart constructor.
data FailedS3Resource = FailedS3Resource'
  { -- | (Discontinued) The status code of a failed item.
    FailedS3Resource -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | (Discontinued) The error message of a failed item.
    FailedS3Resource -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | (Discontinued) The failed S3 resources.
    FailedS3Resource -> Maybe S3Resource
failedItem :: Prelude.Maybe S3Resource
  }
  deriving (FailedS3Resource -> FailedS3Resource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailedS3Resource -> FailedS3Resource -> Bool
$c/= :: FailedS3Resource -> FailedS3Resource -> Bool
== :: FailedS3Resource -> FailedS3Resource -> Bool
$c== :: FailedS3Resource -> FailedS3Resource -> Bool
Prelude.Eq, ReadPrec [FailedS3Resource]
ReadPrec FailedS3Resource
Int -> ReadS FailedS3Resource
ReadS [FailedS3Resource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailedS3Resource]
$creadListPrec :: ReadPrec [FailedS3Resource]
readPrec :: ReadPrec FailedS3Resource
$creadPrec :: ReadPrec FailedS3Resource
readList :: ReadS [FailedS3Resource]
$creadList :: ReadS [FailedS3Resource]
readsPrec :: Int -> ReadS FailedS3Resource
$creadsPrec :: Int -> ReadS FailedS3Resource
Prelude.Read, Int -> FailedS3Resource -> ShowS
[FailedS3Resource] -> ShowS
FailedS3Resource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailedS3Resource] -> ShowS
$cshowList :: [FailedS3Resource] -> ShowS
show :: FailedS3Resource -> String
$cshow :: FailedS3Resource -> String
showsPrec :: Int -> FailedS3Resource -> ShowS
$cshowsPrec :: Int -> FailedS3Resource -> ShowS
Prelude.Show, forall x. Rep FailedS3Resource x -> FailedS3Resource
forall x. FailedS3Resource -> Rep FailedS3Resource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FailedS3Resource x -> FailedS3Resource
$cfrom :: forall x. FailedS3Resource -> Rep FailedS3Resource x
Prelude.Generic)

-- |
-- Create a value of 'FailedS3Resource' 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:
--
-- 'errorCode', 'failedS3Resource_errorCode' - (Discontinued) The status code of a failed item.
--
-- 'errorMessage', 'failedS3Resource_errorMessage' - (Discontinued) The error message of a failed item.
--
-- 'failedItem', 'failedS3Resource_failedItem' - (Discontinued) The failed S3 resources.
newFailedS3Resource ::
  FailedS3Resource
newFailedS3Resource :: FailedS3Resource
newFailedS3Resource =
  FailedS3Resource'
    { $sel:errorCode:FailedS3Resource' :: Maybe Text
errorCode = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:FailedS3Resource' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:failedItem:FailedS3Resource' :: Maybe S3Resource
failedItem = forall a. Maybe a
Prelude.Nothing
    }

-- | (Discontinued) The status code of a failed item.
failedS3Resource_errorCode :: Lens.Lens' FailedS3Resource (Prelude.Maybe Prelude.Text)
failedS3Resource_errorCode :: Lens' FailedS3Resource (Maybe Text)
failedS3Resource_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedS3Resource' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:FailedS3Resource' :: FailedS3Resource -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: FailedS3Resource
s@FailedS3Resource' {} Maybe Text
a -> FailedS3Resource
s {$sel:errorCode:FailedS3Resource' :: Maybe Text
errorCode = Maybe Text
a} :: FailedS3Resource)

-- | (Discontinued) The error message of a failed item.
failedS3Resource_errorMessage :: Lens.Lens' FailedS3Resource (Prelude.Maybe Prelude.Text)
failedS3Resource_errorMessage :: Lens' FailedS3Resource (Maybe Text)
failedS3Resource_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedS3Resource' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:FailedS3Resource' :: FailedS3Resource -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: FailedS3Resource
s@FailedS3Resource' {} Maybe Text
a -> FailedS3Resource
s {$sel:errorMessage:FailedS3Resource' :: Maybe Text
errorMessage = Maybe Text
a} :: FailedS3Resource)

-- | (Discontinued) The failed S3 resources.
failedS3Resource_failedItem :: Lens.Lens' FailedS3Resource (Prelude.Maybe S3Resource)
failedS3Resource_failedItem :: Lens' FailedS3Resource (Maybe S3Resource)
failedS3Resource_failedItem = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedS3Resource' {Maybe S3Resource
failedItem :: Maybe S3Resource
$sel:failedItem:FailedS3Resource' :: FailedS3Resource -> Maybe S3Resource
failedItem} -> Maybe S3Resource
failedItem) (\s :: FailedS3Resource
s@FailedS3Resource' {} Maybe S3Resource
a -> FailedS3Resource
s {$sel:failedItem:FailedS3Resource' :: Maybe S3Resource
failedItem = Maybe S3Resource
a} :: FailedS3Resource)

instance Data.FromJSON FailedS3Resource where
  parseJSON :: Value -> Parser FailedS3Resource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FailedS3Resource"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe S3Resource -> FailedS3Resource
FailedS3Resource'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"errorCode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"errorMessage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"failedItem")
      )

instance Prelude.Hashable FailedS3Resource where
  hashWithSalt :: Int -> FailedS3Resource -> Int
hashWithSalt Int
_salt FailedS3Resource' {Maybe Text
Maybe S3Resource
failedItem :: Maybe S3Resource
errorMessage :: Maybe Text
errorCode :: Maybe Text
$sel:failedItem:FailedS3Resource' :: FailedS3Resource -> Maybe S3Resource
$sel:errorMessage:FailedS3Resource' :: FailedS3Resource -> Maybe Text
$sel:errorCode:FailedS3Resource' :: FailedS3Resource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3Resource
failedItem

instance Prelude.NFData FailedS3Resource where
  rnf :: FailedS3Resource -> ()
rnf FailedS3Resource' {Maybe Text
Maybe S3Resource
failedItem :: Maybe S3Resource
errorMessage :: Maybe Text
errorCode :: Maybe Text
$sel:failedItem:FailedS3Resource' :: FailedS3Resource -> Maybe S3Resource
$sel:errorMessage:FailedS3Resource' :: FailedS3Resource -> Maybe Text
$sel:errorCode:FailedS3Resource' :: FailedS3Resource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3Resource
failedItem