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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(Delete -> Delete -> Bool)
-> (Delete -> Delete -> Bool) -> Eq Delete
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]
(Int -> ReadS Delete)
-> ReadS [Delete]
-> ReadPrec Delete
-> ReadPrec [Delete]
-> Read 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
(Int -> Delete -> ShowS)
-> (Delete -> String) -> ([Delete] -> ShowS) -> Show Delete
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. Delete -> Rep Delete x)
-> (forall x. Rep Delete x -> Delete) -> Generic Delete
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' :: Maybe Bool -> [ObjectIdentifier] -> Delete
Delete'
    { $sel:quiet:Delete' :: Maybe Bool
quiet = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:objects:Delete' :: [ObjectIdentifier]
objects = [ObjectIdentifier]
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 :: (Maybe Bool -> f (Maybe Bool)) -> Delete -> f Delete
delete_quiet = (Delete -> Maybe Bool)
-> (Delete -> Maybe Bool -> Delete)
-> Lens Delete Delete (Maybe Bool) (Maybe Bool)
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 :: ([ObjectIdentifier] -> f [ObjectIdentifier]) -> Delete -> f Delete
delete_objects = (Delete -> [ObjectIdentifier])
-> (Delete -> [ObjectIdentifier] -> Delete)
-> Lens Delete Delete [ObjectIdentifier] [ObjectIdentifier]
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) (([ObjectIdentifier] -> f [ObjectIdentifier])
 -> Delete -> f Delete)
-> (([ObjectIdentifier] -> f [ObjectIdentifier])
    -> [ObjectIdentifier] -> f [ObjectIdentifier])
-> ([ObjectIdentifier] -> f [ObjectIdentifier])
-> Delete
-> f Delete
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ObjectIdentifier] -> f [ObjectIdentifier])
-> [ObjectIdentifier] -> f [ObjectIdentifier]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable Delete

instance Prelude.NFData Delete

instance Core.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
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"Quiet" Name -> Maybe Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Bool
quiet,
        Name -> [ObjectIdentifier] -> XML
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Core.toXMLList Name
"Object" [ObjectIdentifier]
objects
      ]