{-# 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.S3.Types.Delete
-- 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.S3.Types.Delete where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.ObjectIdentifier

-- | Container for the objects to delete.
--
-- /See:/ 'newDelete' smart constructor.
data Delete = Delete'
  { -- | Element to enable quiet mode for the request. When you add this element,
    -- you must set its value to true.
    Delete -> Maybe Bool
quiet :: Prelude.Maybe Prelude.Bool,
    -- | The objects to delete.
    Delete -> [ObjectIdentifier]
objects :: [ObjectIdentifier]
  }
  deriving (Delete -> Delete -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Delete -> Delete -> Bool
$c/= :: Delete -> Delete -> Bool
== :: Delete -> Delete -> Bool
$c== :: Delete -> Delete -> Bool
Prelude.Eq, ReadPrec [Delete]
ReadPrec Delete
Int -> ReadS Delete
ReadS [Delete]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Delete]
$creadListPrec :: ReadPrec [Delete]
readPrec :: ReadPrec Delete
$creadPrec :: ReadPrec Delete
readList :: ReadS [Delete]
$creadList :: ReadS [Delete]
readsPrec :: Int -> ReadS Delete
$creadsPrec :: Int -> ReadS Delete
Prelude.Read, Int -> Delete -> ShowS
[Delete] -> ShowS
Delete -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Delete] -> ShowS
$cshowList :: [Delete] -> ShowS
show :: Delete -> String
$cshow :: Delete -> String
showsPrec :: Int -> Delete -> ShowS
$cshowsPrec :: Int -> Delete -> ShowS
Prelude.Show, forall x. Rep Delete x -> Delete
forall x. Delete -> Rep Delete x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Delete x -> Delete
$cfrom :: forall x. Delete -> Rep Delete x
Prelude.Generic)

-- |
-- Create a value of 'Delete' 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:
--
-- 'quiet', 'delete_quiet' - Element to enable quiet mode for the request. When you add this element,
-- you must set its value to true.
--
-- 'objects', 'delete_objects' - The objects to delete.
newDelete ::
  Delete
newDelete :: Delete
newDelete =
  Delete'
    { $sel:quiet:Delete' :: Maybe Bool
quiet = forall a. Maybe a
Prelude.Nothing,
      $sel:objects:Delete' :: [ObjectIdentifier]
objects = forall a. Monoid a => a
Prelude.mempty
    }

-- | Element to enable quiet mode for the request. When you add this element,
-- you must set its value to true.
delete_quiet :: Lens.Lens' Delete (Prelude.Maybe Prelude.Bool)
delete_quiet :: Lens' Delete (Maybe Bool)
delete_quiet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Delete' {Maybe Bool
quiet :: Maybe Bool
$sel:quiet:Delete' :: Delete -> Maybe Bool
quiet} -> Maybe Bool
quiet) (\s :: Delete
s@Delete' {} Maybe Bool
a -> Delete
s {$sel:quiet:Delete' :: Maybe Bool
quiet = Maybe Bool
a} :: Delete)

-- | The objects to delete.
delete_objects :: Lens.Lens' Delete [ObjectIdentifier]
delete_objects :: Lens' Delete [ObjectIdentifier]
delete_objects = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Delete' {[ObjectIdentifier]
objects :: [ObjectIdentifier]
$sel:objects:Delete' :: Delete -> [ObjectIdentifier]
objects} -> [ObjectIdentifier]
objects) (\s :: Delete
s@Delete' {} [ObjectIdentifier]
a -> Delete
s {$sel:objects:Delete' :: [ObjectIdentifier]
objects = [ObjectIdentifier]
a} :: Delete) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable Delete where
  hashWithSalt :: Int -> Delete -> Int
hashWithSalt Int
_salt Delete' {[ObjectIdentifier]
Maybe Bool
objects :: [ObjectIdentifier]
quiet :: Maybe Bool
$sel:objects:Delete' :: Delete -> [ObjectIdentifier]
$sel:quiet:Delete' :: Delete -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
quiet
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [ObjectIdentifier]
objects

instance Prelude.NFData Delete where
  rnf :: Delete -> ()
rnf Delete' {[ObjectIdentifier]
Maybe Bool
objects :: [ObjectIdentifier]
quiet :: Maybe Bool
$sel:objects:Delete' :: Delete -> [ObjectIdentifier]
$sel:quiet:Delete' :: Delete -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
quiet seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ObjectIdentifier]
objects

instance Data.ToXML Delete where
  toXML :: Delete -> XML
toXML Delete' {[ObjectIdentifier]
Maybe Bool
objects :: [ObjectIdentifier]
quiet :: Maybe Bool
$sel:objects:Delete' :: Delete -> [ObjectIdentifier]
$sel:quiet:Delete' :: Delete -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"Quiet" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Bool
quiet,
        forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"Object" [ObjectIdentifier]
objects
      ]