{-# 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.IndexDocument
-- 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.IndexDocument where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal

-- | Container for the @Suffix@ element.
--
-- /See:/ 'newIndexDocument' smart constructor.
data IndexDocument = IndexDocument'
  { -- | A suffix that is appended to a request that is for a directory on the
    -- website endpoint (for example,if the suffix is index.html and you make a
    -- request to samplebucket\/images\/ the data that is returned will be for
    -- the object with the key name images\/index.html) The suffix must not be
    -- empty and must not include a slash character.
    --
    -- Replacement must be made for object keys containing special characters
    -- (such as carriage returns) when using XML requests. For more
    -- information, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints XML related object key constraints>.
    IndexDocument -> Text
suffix :: Prelude.Text
  }
  deriving (IndexDocument -> IndexDocument -> Bool
(IndexDocument -> IndexDocument -> Bool)
-> (IndexDocument -> IndexDocument -> Bool) -> Eq IndexDocument
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IndexDocument -> IndexDocument -> Bool
$c/= :: IndexDocument -> IndexDocument -> Bool
== :: IndexDocument -> IndexDocument -> Bool
$c== :: IndexDocument -> IndexDocument -> Bool
Prelude.Eq, ReadPrec [IndexDocument]
ReadPrec IndexDocument
Int -> ReadS IndexDocument
ReadS [IndexDocument]
(Int -> ReadS IndexDocument)
-> ReadS [IndexDocument]
-> ReadPrec IndexDocument
-> ReadPrec [IndexDocument]
-> Read IndexDocument
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IndexDocument]
$creadListPrec :: ReadPrec [IndexDocument]
readPrec :: ReadPrec IndexDocument
$creadPrec :: ReadPrec IndexDocument
readList :: ReadS [IndexDocument]
$creadList :: ReadS [IndexDocument]
readsPrec :: Int -> ReadS IndexDocument
$creadsPrec :: Int -> ReadS IndexDocument
Prelude.Read, Int -> IndexDocument -> ShowS
[IndexDocument] -> ShowS
IndexDocument -> String
(Int -> IndexDocument -> ShowS)
-> (IndexDocument -> String)
-> ([IndexDocument] -> ShowS)
-> Show IndexDocument
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IndexDocument] -> ShowS
$cshowList :: [IndexDocument] -> ShowS
show :: IndexDocument -> String
$cshow :: IndexDocument -> String
showsPrec :: Int -> IndexDocument -> ShowS
$cshowsPrec :: Int -> IndexDocument -> ShowS
Prelude.Show, (forall x. IndexDocument -> Rep IndexDocument x)
-> (forall x. Rep IndexDocument x -> IndexDocument)
-> Generic IndexDocument
forall x. Rep IndexDocument x -> IndexDocument
forall x. IndexDocument -> Rep IndexDocument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IndexDocument x -> IndexDocument
$cfrom :: forall x. IndexDocument -> Rep IndexDocument x
Prelude.Generic)

-- |
-- Create a value of 'IndexDocument' 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:
--
-- 'suffix', 'indexDocument_suffix' - A suffix that is appended to a request that is for a directory on the
-- website endpoint (for example,if the suffix is index.html and you make a
-- request to samplebucket\/images\/ the data that is returned will be for
-- the object with the key name images\/index.html) The suffix must not be
-- empty and must not include a slash character.
--
-- Replacement must be made for object keys containing special characters
-- (such as carriage returns) when using XML requests. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints XML related object key constraints>.
newIndexDocument ::
  -- | 'suffix'
  Prelude.Text ->
  IndexDocument
newIndexDocument :: Text -> IndexDocument
newIndexDocument Text
pSuffix_ =
  IndexDocument' :: Text -> IndexDocument
IndexDocument' {$sel:suffix:IndexDocument' :: Text
suffix = Text
pSuffix_}

-- | A suffix that is appended to a request that is for a directory on the
-- website endpoint (for example,if the suffix is index.html and you make a
-- request to samplebucket\/images\/ the data that is returned will be for
-- the object with the key name images\/index.html) The suffix must not be
-- empty and must not include a slash character.
--
-- Replacement must be made for object keys containing special characters
-- (such as carriage returns) when using XML requests. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints XML related object key constraints>.
indexDocument_suffix :: Lens.Lens' IndexDocument Prelude.Text
indexDocument_suffix :: (Text -> f Text) -> IndexDocument -> f IndexDocument
indexDocument_suffix = (IndexDocument -> Text)
-> (IndexDocument -> Text -> IndexDocument)
-> Lens IndexDocument IndexDocument Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IndexDocument' {Text
suffix :: Text
$sel:suffix:IndexDocument' :: IndexDocument -> Text
suffix} -> Text
suffix) (\s :: IndexDocument
s@IndexDocument' {} Text
a -> IndexDocument
s {$sel:suffix:IndexDocument' :: Text
suffix = Text
a} :: IndexDocument)

instance Core.FromXML IndexDocument where
  parseXML :: [Node] -> Either String IndexDocument
parseXML [Node]
x =
    Text -> IndexDocument
IndexDocument' (Text -> IndexDocument)
-> Either String Text -> Either String IndexDocument
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Suffix")

instance Prelude.Hashable IndexDocument

instance Prelude.NFData IndexDocument

instance Core.ToXML IndexDocument where
  toXML :: IndexDocument -> XML
toXML IndexDocument' {Text
suffix :: Text
$sel:suffix:IndexDocument' :: IndexDocument -> Text
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"Suffix" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
suffix]