{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.ListObjects
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns some or all (up to 1,000) of the objects in a bucket. You can
-- use the request parameters as selection criteria to return a subset of
-- the objects in a bucket. A 200 OK response can contain valid or invalid
-- XML. Be sure to design your application to parse the contents of the
-- response and handle it appropriately.
--
-- This action has been revised. We recommend that you use the newer
-- version,
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html ListObjectsV2>,
-- when developing applications. For backward compatibility, Amazon S3
-- continues to support @ListObjects@.
--
-- The following operations are related to @ListObjects@:
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html ListObjectsV2>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html GetObject>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html PutObject>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html CreateBucket>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html ListBuckets>
--
-- This operation returns paginated results.
module Amazonka.S3.ListObjects
  ( -- * Creating a Request
    ListObjects (..),
    newListObjects,

    -- * Request Lenses
    listObjects_delimiter,
    listObjects_encodingType,
    listObjects_expectedBucketOwner,
    listObjects_marker,
    listObjects_maxKeys,
    listObjects_prefix,
    listObjects_requestPayer,
    listObjects_bucket,

    -- * Destructuring the Response
    ListObjectsResponse (..),
    newListObjectsResponse,

    -- * Response Lenses
    listObjectsResponse_commonPrefixes,
    listObjectsResponse_contents,
    listObjectsResponse_delimiter,
    listObjectsResponse_encodingType,
    listObjectsResponse_isTruncated,
    listObjectsResponse_marker,
    listObjectsResponse_maxKeys,
    listObjectsResponse_name,
    listObjectsResponse_nextMarker,
    listObjectsResponse_prefix,
    listObjectsResponse_httpStatus,
  )
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.S3.Types

-- | /See:/ 'newListObjects' smart constructor.
data ListObjects = ListObjects'
  { -- | A delimiter is a character you use to group keys.
    ListObjects -> Maybe Delimiter
delimiter :: Prelude.Maybe Delimiter,
    ListObjects -> Maybe EncodingType
encodingType :: Prelude.Maybe EncodingType,
    -- | The account ID of the expected bucket owner. If the bucket is owned by a
    -- different account, the request fails with the HTTP status code
    -- @403 Forbidden@ (access denied).
    ListObjects -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | Marker is where you want Amazon S3 to start listing from. Amazon S3
    -- starts listing after this specified key. Marker can be any key in the
    -- bucket.
    ListObjects -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | Sets the maximum number of keys returned in the response. By default the
    -- action returns up to 1,000 key names. The response might contain fewer
    -- keys but will never contain more.
    ListObjects -> Maybe Int
maxKeys :: Prelude.Maybe Prelude.Int,
    -- | Limits the response to keys that begin with the specified prefix.
    ListObjects -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
    -- | Confirms that the requester knows that she or he will be charged for the
    -- list objects request. Bucket owners need not specify this parameter in
    -- their requests.
    ListObjects -> Maybe RequestPayer
requestPayer :: Prelude.Maybe RequestPayer,
    -- | The name of the bucket containing the objects.
    --
    -- When using this action with an access point, you must direct requests to
    -- the access point hostname. The access point hostname takes the form
    -- /AccessPointName/-/AccountId/.s3-accesspoint./Region/.amazonaws.com.
    -- When using this action with an access point through the Amazon Web
    -- Services SDKs, you provide the access point ARN in place of the bucket
    -- name. For more information about access point ARNs, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html Using access points>
    -- in the /Amazon S3 User Guide/.
    --
    -- When using this action with Amazon S3 on Outposts, you must direct
    -- requests to the S3 on Outposts hostname. The S3 on Outposts hostname
    -- takes the form
    -- @ @/@AccessPointName@/@-@/@AccountId@/@.@/@outpostID@/@.s3-outposts.@/@Region@/@.amazonaws.com@.
    -- When using this action with S3 on Outposts through the Amazon Web
    -- Services SDKs, you provide the Outposts bucket ARN in place of the
    -- bucket name. For more information about S3 on Outposts ARNs, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using Amazon S3 on Outposts>
    -- in the /Amazon S3 User Guide/.
    ListObjects -> BucketName
bucket :: BucketName
  }
  deriving (ListObjects -> ListObjects -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListObjects -> ListObjects -> Bool
$c/= :: ListObjects -> ListObjects -> Bool
== :: ListObjects -> ListObjects -> Bool
$c== :: ListObjects -> ListObjects -> Bool
Prelude.Eq, ReadPrec [ListObjects]
ReadPrec ListObjects
Int -> ReadS ListObjects
ReadS [ListObjects]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListObjects]
$creadListPrec :: ReadPrec [ListObjects]
readPrec :: ReadPrec ListObjects
$creadPrec :: ReadPrec ListObjects
readList :: ReadS [ListObjects]
$creadList :: ReadS [ListObjects]
readsPrec :: Int -> ReadS ListObjects
$creadsPrec :: Int -> ReadS ListObjects
Prelude.Read, Int -> ListObjects -> ShowS
[ListObjects] -> ShowS
ListObjects -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListObjects] -> ShowS
$cshowList :: [ListObjects] -> ShowS
show :: ListObjects -> String
$cshow :: ListObjects -> String
showsPrec :: Int -> ListObjects -> ShowS
$cshowsPrec :: Int -> ListObjects -> ShowS
Prelude.Show, forall x. Rep ListObjects x -> ListObjects
forall x. ListObjects -> Rep ListObjects x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListObjects x -> ListObjects
$cfrom :: forall x. ListObjects -> Rep ListObjects x
Prelude.Generic)

-- |
-- Create a value of 'ListObjects' 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:
--
-- 'delimiter', 'listObjects_delimiter' - A delimiter is a character you use to group keys.
--
-- 'encodingType', 'listObjects_encodingType' - Undocumented member.
--
-- 'expectedBucketOwner', 'listObjects_expectedBucketOwner' - The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request fails with the HTTP status code
-- @403 Forbidden@ (access denied).
--
-- 'marker', 'listObjects_marker' - Marker is where you want Amazon S3 to start listing from. Amazon S3
-- starts listing after this specified key. Marker can be any key in the
-- bucket.
--
-- 'maxKeys', 'listObjects_maxKeys' - Sets the maximum number of keys returned in the response. By default the
-- action returns up to 1,000 key names. The response might contain fewer
-- keys but will never contain more.
--
-- 'prefix', 'listObjects_prefix' - Limits the response to keys that begin with the specified prefix.
--
-- 'requestPayer', 'listObjects_requestPayer' - Confirms that the requester knows that she or he will be charged for the
-- list objects request. Bucket owners need not specify this parameter in
-- their requests.
--
-- 'bucket', 'listObjects_bucket' - The name of the bucket containing the objects.
--
-- When using this action with an access point, you must direct requests to
-- the access point hostname. The access point hostname takes the form
-- /AccessPointName/-/AccountId/.s3-accesspoint./Region/.amazonaws.com.
-- When using this action with an access point through the Amazon Web
-- Services SDKs, you provide the access point ARN in place of the bucket
-- name. For more information about access point ARNs, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html Using access points>
-- in the /Amazon S3 User Guide/.
--
-- When using this action with Amazon S3 on Outposts, you must direct
-- requests to the S3 on Outposts hostname. The S3 on Outposts hostname
-- takes the form
-- @ @/@AccessPointName@/@-@/@AccountId@/@.@/@outpostID@/@.s3-outposts.@/@Region@/@.amazonaws.com@.
-- When using this action with S3 on Outposts through the Amazon Web
-- Services SDKs, you provide the Outposts bucket ARN in place of the
-- bucket name. For more information about S3 on Outposts ARNs, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using Amazon S3 on Outposts>
-- in the /Amazon S3 User Guide/.
newListObjects ::
  -- | 'bucket'
  BucketName ->
  ListObjects
newListObjects :: BucketName -> ListObjects
newListObjects BucketName
pBucket_ =
  ListObjects'
    { $sel:delimiter:ListObjects' :: Maybe Delimiter
delimiter = forall a. Maybe a
Prelude.Nothing,
      $sel:encodingType:ListObjects' :: Maybe EncodingType
encodingType = forall a. Maybe a
Prelude.Nothing,
      $sel:expectedBucketOwner:ListObjects' :: Maybe Text
expectedBucketOwner = forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListObjects' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:maxKeys:ListObjects' :: Maybe Int
maxKeys = forall a. Maybe a
Prelude.Nothing,
      $sel:prefix:ListObjects' :: Maybe Text
prefix = forall a. Maybe a
Prelude.Nothing,
      $sel:requestPayer:ListObjects' :: Maybe RequestPayer
requestPayer = forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:ListObjects' :: BucketName
bucket = BucketName
pBucket_
    }

-- | A delimiter is a character you use to group keys.
listObjects_delimiter :: Lens.Lens' ListObjects (Prelude.Maybe Delimiter)
listObjects_delimiter :: Lens' ListObjects (Maybe Delimiter)
listObjects_delimiter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjects' {Maybe Delimiter
delimiter :: Maybe Delimiter
$sel:delimiter:ListObjects' :: ListObjects -> Maybe Delimiter
delimiter} -> Maybe Delimiter
delimiter) (\s :: ListObjects
s@ListObjects' {} Maybe Delimiter
a -> ListObjects
s {$sel:delimiter:ListObjects' :: Maybe Delimiter
delimiter = Maybe Delimiter
a} :: ListObjects)

-- | Undocumented member.
listObjects_encodingType :: Lens.Lens' ListObjects (Prelude.Maybe EncodingType)
listObjects_encodingType :: Lens' ListObjects (Maybe EncodingType)
listObjects_encodingType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjects' {Maybe EncodingType
encodingType :: Maybe EncodingType
$sel:encodingType:ListObjects' :: ListObjects -> Maybe EncodingType
encodingType} -> Maybe EncodingType
encodingType) (\s :: ListObjects
s@ListObjects' {} Maybe EncodingType
a -> ListObjects
s {$sel:encodingType:ListObjects' :: Maybe EncodingType
encodingType = Maybe EncodingType
a} :: ListObjects)

-- | The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request fails with the HTTP status code
-- @403 Forbidden@ (access denied).
listObjects_expectedBucketOwner :: Lens.Lens' ListObjects (Prelude.Maybe Prelude.Text)
listObjects_expectedBucketOwner :: Lens' ListObjects (Maybe Text)
listObjects_expectedBucketOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjects' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:ListObjects' :: ListObjects -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: ListObjects
s@ListObjects' {} Maybe Text
a -> ListObjects
s {$sel:expectedBucketOwner:ListObjects' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: ListObjects)

-- | Marker is where you want Amazon S3 to start listing from. Amazon S3
-- starts listing after this specified key. Marker can be any key in the
-- bucket.
listObjects_marker :: Lens.Lens' ListObjects (Prelude.Maybe Prelude.Text)
listObjects_marker :: Lens' ListObjects (Maybe Text)
listObjects_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjects' {Maybe Text
marker :: Maybe Text
$sel:marker:ListObjects' :: ListObjects -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListObjects
s@ListObjects' {} Maybe Text
a -> ListObjects
s {$sel:marker:ListObjects' :: Maybe Text
marker = Maybe Text
a} :: ListObjects)

-- | Sets the maximum number of keys returned in the response. By default the
-- action returns up to 1,000 key names. The response might contain fewer
-- keys but will never contain more.
listObjects_maxKeys :: Lens.Lens' ListObjects (Prelude.Maybe Prelude.Int)
listObjects_maxKeys :: Lens' ListObjects (Maybe Int)
listObjects_maxKeys = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjects' {Maybe Int
maxKeys :: Maybe Int
$sel:maxKeys:ListObjects' :: ListObjects -> Maybe Int
maxKeys} -> Maybe Int
maxKeys) (\s :: ListObjects
s@ListObjects' {} Maybe Int
a -> ListObjects
s {$sel:maxKeys:ListObjects' :: Maybe Int
maxKeys = Maybe Int
a} :: ListObjects)

-- | Limits the response to keys that begin with the specified prefix.
listObjects_prefix :: Lens.Lens' ListObjects (Prelude.Maybe Prelude.Text)
listObjects_prefix :: Lens' ListObjects (Maybe Text)
listObjects_prefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjects' {Maybe Text
prefix :: Maybe Text
$sel:prefix:ListObjects' :: ListObjects -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: ListObjects
s@ListObjects' {} Maybe Text
a -> ListObjects
s {$sel:prefix:ListObjects' :: Maybe Text
prefix = Maybe Text
a} :: ListObjects)

-- | Confirms that the requester knows that she or he will be charged for the
-- list objects request. Bucket owners need not specify this parameter in
-- their requests.
listObjects_requestPayer :: Lens.Lens' ListObjects (Prelude.Maybe RequestPayer)
listObjects_requestPayer :: Lens' ListObjects (Maybe RequestPayer)
listObjects_requestPayer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjects' {Maybe RequestPayer
requestPayer :: Maybe RequestPayer
$sel:requestPayer:ListObjects' :: ListObjects -> Maybe RequestPayer
requestPayer} -> Maybe RequestPayer
requestPayer) (\s :: ListObjects
s@ListObjects' {} Maybe RequestPayer
a -> ListObjects
s {$sel:requestPayer:ListObjects' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
a} :: ListObjects)

-- | The name of the bucket containing the objects.
--
-- When using this action with an access point, you must direct requests to
-- the access point hostname. The access point hostname takes the form
-- /AccessPointName/-/AccountId/.s3-accesspoint./Region/.amazonaws.com.
-- When using this action with an access point through the Amazon Web
-- Services SDKs, you provide the access point ARN in place of the bucket
-- name. For more information about access point ARNs, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html Using access points>
-- in the /Amazon S3 User Guide/.
--
-- When using this action with Amazon S3 on Outposts, you must direct
-- requests to the S3 on Outposts hostname. The S3 on Outposts hostname
-- takes the form
-- @ @/@AccessPointName@/@-@/@AccountId@/@.@/@outpostID@/@.s3-outposts.@/@Region@/@.amazonaws.com@.
-- When using this action with S3 on Outposts through the Amazon Web
-- Services SDKs, you provide the Outposts bucket ARN in place of the
-- bucket name. For more information about S3 on Outposts ARNs, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using Amazon S3 on Outposts>
-- in the /Amazon S3 User Guide/.
listObjects_bucket :: Lens.Lens' ListObjects BucketName
listObjects_bucket :: Lens' ListObjects BucketName
listObjects_bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjects' {BucketName
bucket :: BucketName
$sel:bucket:ListObjects' :: ListObjects -> BucketName
bucket} -> BucketName
bucket) (\s :: ListObjects
s@ListObjects' {} BucketName
a -> ListObjects
s {$sel:bucket:ListObjects' :: BucketName
bucket = BucketName
a} :: ListObjects)

instance Core.AWSPager ListObjects where
  page :: ListObjects -> AWSResponse ListObjects -> Maybe ListObjects
page ListObjects
rq AWSResponse ListObjects
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListObjects
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListObjectsResponse (Maybe Bool)
listObjectsResponse_isTruncated
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListObjects
rs
            forall s a. s -> Getting a s a -> a
Lens.^. forall (f :: * -> *) a b s.
(Alternative f, ToText a, ToText b) =>
(s -> f a) -> (s -> f b) -> Getter s (f Text)
Core.choice
              ( forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^?
                  ( Lens' ListObjectsResponse (Maybe Text)
listObjectsResponse_nextMarker
                      forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                  )
              )
              ( forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^?
                  ( Lens' ListObjectsResponse (Maybe [Object])
listObjectsResponse_contents
                      forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                      forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s a. Snoc s s a a => Traversal' s a
Lens._last
                      forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' Object ObjectKey
object_key
                  )
              )
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListObjects
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListObjects (Maybe Text)
listObjects_marker
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListObjects
rs
          forall s a. s -> Getting a s a -> a
Lens.^. forall (f :: * -> *) a b s.
(Alternative f, ToText a, ToText b) =>
(s -> f a) -> (s -> f b) -> Getter s (f Text)
Core.choice
            ( forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^?
                ( Lens' ListObjectsResponse (Maybe Text)
listObjectsResponse_nextMarker
                    forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                )
            )
            ( forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^?
                ( Lens' ListObjectsResponse (Maybe [Object])
listObjectsResponse_contents
                    forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s a. Snoc s s a a => Traversal' s a
Lens._last
                    forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' Object ObjectKey
object_key
                )
            )

instance Core.AWSRequest ListObjects where
  type AWSResponse ListObjects = ListObjectsResponse
  request :: (Service -> Service) -> ListObjects -> Request ListObjects
request Service -> Service
overrides =
    forall a. Request a -> Request a
Request.s3vhost
      forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListObjects
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListObjects)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [CommonPrefix]
-> Maybe [Object]
-> Maybe Delimiter
-> Maybe EncodingType
-> Maybe Bool
-> Maybe Text
-> Maybe Int
-> Maybe BucketName
-> Maybe Text
-> Maybe Text
-> Int
-> ListObjectsResponse
ListObjectsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"CommonPrefixes") [Node]
x)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"Contents") [Node]
x)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Delimiter")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"EncodingType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IsTruncated")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Marker")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"MaxKeys")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NextMarker")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Prefix")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListObjects where
  hashWithSalt :: Int -> ListObjects -> Int
hashWithSalt Int
_salt ListObjects' {Maybe Delimiter
Maybe Int
Maybe Text
Maybe EncodingType
Maybe RequestPayer
BucketName
bucket :: BucketName
requestPayer :: Maybe RequestPayer
prefix :: Maybe Text
maxKeys :: Maybe Int
marker :: Maybe Text
expectedBucketOwner :: Maybe Text
encodingType :: Maybe EncodingType
delimiter :: Maybe Delimiter
$sel:bucket:ListObjects' :: ListObjects -> BucketName
$sel:requestPayer:ListObjects' :: ListObjects -> Maybe RequestPayer
$sel:prefix:ListObjects' :: ListObjects -> Maybe Text
$sel:maxKeys:ListObjects' :: ListObjects -> Maybe Int
$sel:marker:ListObjects' :: ListObjects -> Maybe Text
$sel:expectedBucketOwner:ListObjects' :: ListObjects -> Maybe Text
$sel:encodingType:ListObjects' :: ListObjects -> Maybe EncodingType
$sel:delimiter:ListObjects' :: ListObjects -> Maybe Delimiter
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Delimiter
delimiter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EncodingType
encodingType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
expectedBucketOwner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxKeys
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
prefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RequestPayer
requestPayer
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BucketName
bucket

instance Prelude.NFData ListObjects where
  rnf :: ListObjects -> ()
rnf ListObjects' {Maybe Delimiter
Maybe Int
Maybe Text
Maybe EncodingType
Maybe RequestPayer
BucketName
bucket :: BucketName
requestPayer :: Maybe RequestPayer
prefix :: Maybe Text
maxKeys :: Maybe Int
marker :: Maybe Text
expectedBucketOwner :: Maybe Text
encodingType :: Maybe EncodingType
delimiter :: Maybe Delimiter
$sel:bucket:ListObjects' :: ListObjects -> BucketName
$sel:requestPayer:ListObjects' :: ListObjects -> Maybe RequestPayer
$sel:prefix:ListObjects' :: ListObjects -> Maybe Text
$sel:maxKeys:ListObjects' :: ListObjects -> Maybe Int
$sel:marker:ListObjects' :: ListObjects -> Maybe Text
$sel:expectedBucketOwner:ListObjects' :: ListObjects -> Maybe Text
$sel:encodingType:ListObjects' :: ListObjects -> Maybe EncodingType
$sel:delimiter:ListObjects' :: ListObjects -> Maybe Delimiter
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Delimiter
delimiter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EncodingType
encodingType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
expectedBucketOwner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxKeys
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
prefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RequestPayer
requestPayer
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf BucketName
bucket

instance Data.ToHeaders ListObjects where
  toHeaders :: ListObjects -> ResponseHeaders
toHeaders ListObjects' {Maybe Delimiter
Maybe Int
Maybe Text
Maybe EncodingType
Maybe RequestPayer
BucketName
bucket :: BucketName
requestPayer :: Maybe RequestPayer
prefix :: Maybe Text
maxKeys :: Maybe Int
marker :: Maybe Text
expectedBucketOwner :: Maybe Text
encodingType :: Maybe EncodingType
delimiter :: Maybe Delimiter
$sel:bucket:ListObjects' :: ListObjects -> BucketName
$sel:requestPayer:ListObjects' :: ListObjects -> Maybe RequestPayer
$sel:prefix:ListObjects' :: ListObjects -> Maybe Text
$sel:maxKeys:ListObjects' :: ListObjects -> Maybe Int
$sel:marker:ListObjects' :: ListObjects -> Maybe Text
$sel:expectedBucketOwner:ListObjects' :: ListObjects -> Maybe Text
$sel:encodingType:ListObjects' :: ListObjects -> Maybe EncodingType
$sel:delimiter:ListObjects' :: ListObjects -> Maybe Delimiter
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-expected-bucket-owner"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
expectedBucketOwner,
        HeaderName
"x-amz-request-payer" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe RequestPayer
requestPayer
      ]

instance Data.ToPath ListObjects where
  toPath :: ListObjects -> ByteString
toPath ListObjects' {Maybe Delimiter
Maybe Int
Maybe Text
Maybe EncodingType
Maybe RequestPayer
BucketName
bucket :: BucketName
requestPayer :: Maybe RequestPayer
prefix :: Maybe Text
maxKeys :: Maybe Int
marker :: Maybe Text
expectedBucketOwner :: Maybe Text
encodingType :: Maybe EncodingType
delimiter :: Maybe Delimiter
$sel:bucket:ListObjects' :: ListObjects -> BucketName
$sel:requestPayer:ListObjects' :: ListObjects -> Maybe RequestPayer
$sel:prefix:ListObjects' :: ListObjects -> Maybe Text
$sel:maxKeys:ListObjects' :: ListObjects -> Maybe Int
$sel:marker:ListObjects' :: ListObjects -> Maybe Text
$sel:expectedBucketOwner:ListObjects' :: ListObjects -> Maybe Text
$sel:encodingType:ListObjects' :: ListObjects -> Maybe EncodingType
$sel:delimiter:ListObjects' :: ListObjects -> Maybe Delimiter
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", forall a. ToByteString a => a -> ByteString
Data.toBS BucketName
bucket]

instance Data.ToQuery ListObjects where
  toQuery :: ListObjects -> QueryString
toQuery ListObjects' {Maybe Delimiter
Maybe Int
Maybe Text
Maybe EncodingType
Maybe RequestPayer
BucketName
bucket :: BucketName
requestPayer :: Maybe RequestPayer
prefix :: Maybe Text
maxKeys :: Maybe Int
marker :: Maybe Text
expectedBucketOwner :: Maybe Text
encodingType :: Maybe EncodingType
delimiter :: Maybe Delimiter
$sel:bucket:ListObjects' :: ListObjects -> BucketName
$sel:requestPayer:ListObjects' :: ListObjects -> Maybe RequestPayer
$sel:prefix:ListObjects' :: ListObjects -> Maybe Text
$sel:maxKeys:ListObjects' :: ListObjects -> Maybe Int
$sel:marker:ListObjects' :: ListObjects -> Maybe Text
$sel:expectedBucketOwner:ListObjects' :: ListObjects -> Maybe Text
$sel:encodingType:ListObjects' :: ListObjects -> Maybe EncodingType
$sel:delimiter:ListObjects' :: ListObjects -> Maybe Delimiter
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"delimiter" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Delimiter
delimiter,
        ByteString
"encoding-type" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe EncodingType
encodingType,
        ByteString
"marker" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
marker,
        ByteString
"max-keys" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
maxKeys,
        ByteString
"prefix" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
prefix
      ]

-- | /See:/ 'newListObjectsResponse' smart constructor.
data ListObjectsResponse = ListObjectsResponse'
  { -- | All of the keys (up to 1,000) rolled up in a common prefix count as a
    -- single return when calculating the number of returns.
    --
    -- A response can contain CommonPrefixes only if you specify a delimiter.
    --
    -- CommonPrefixes contains all (if there are any) keys between Prefix and
    -- the next occurrence of the string specified by the delimiter.
    --
    -- CommonPrefixes lists keys that act like subdirectories in the directory
    -- specified by Prefix.
    --
    -- For example, if the prefix is notes\/ and the delimiter is a slash (\/)
    -- as in notes\/summer\/july, the common prefix is notes\/summer\/. All of
    -- the keys that roll up into a common prefix count as a single return when
    -- calculating the number of returns.
    ListObjectsResponse -> Maybe [CommonPrefix]
commonPrefixes :: Prelude.Maybe [CommonPrefix],
    -- | Metadata about each object returned.
    ListObjectsResponse -> Maybe [Object]
contents :: Prelude.Maybe [Object],
    -- | Causes keys that contain the same string between the prefix and the
    -- first occurrence of the delimiter to be rolled up into a single result
    -- element in the @CommonPrefixes@ collection. These rolled-up keys are not
    -- returned elsewhere in the response. Each rolled-up result counts as only
    -- one return against the @MaxKeys@ value.
    ListObjectsResponse -> Maybe Delimiter
delimiter :: Prelude.Maybe Delimiter,
    -- | Encoding type used by Amazon S3 to encode object keys in the response.
    ListObjectsResponse -> Maybe EncodingType
encodingType :: Prelude.Maybe EncodingType,
    -- | A flag that indicates whether Amazon S3 returned all of the results that
    -- satisfied the search criteria.
    ListObjectsResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | Indicates where in the bucket listing begins. Marker is included in the
    -- response if it was sent with the request.
    ListObjectsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of keys returned in the response body.
    ListObjectsResponse -> Maybe Int
maxKeys :: Prelude.Maybe Prelude.Int,
    -- | The bucket name.
    ListObjectsResponse -> Maybe BucketName
name :: Prelude.Maybe BucketName,
    -- | When response is truncated (the IsTruncated element value in the
    -- response is true), you can use the key name in this field as marker in
    -- the subsequent request to get next set of objects. Amazon S3 lists
    -- objects in alphabetical order Note: This element is returned only if you
    -- have delimiter request parameter specified. If response does not include
    -- the NextMarker and it is truncated, you can use the value of the last
    -- Key in the response as the marker in the subsequent request to get the
    -- next set of object keys.
    ListObjectsResponse -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | Keys that begin with the indicated prefix.
    ListObjectsResponse -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListObjectsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListObjectsResponse -> ListObjectsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListObjectsResponse -> ListObjectsResponse -> Bool
$c/= :: ListObjectsResponse -> ListObjectsResponse -> Bool
== :: ListObjectsResponse -> ListObjectsResponse -> Bool
$c== :: ListObjectsResponse -> ListObjectsResponse -> Bool
Prelude.Eq, ReadPrec [ListObjectsResponse]
ReadPrec ListObjectsResponse
Int -> ReadS ListObjectsResponse
ReadS [ListObjectsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListObjectsResponse]
$creadListPrec :: ReadPrec [ListObjectsResponse]
readPrec :: ReadPrec ListObjectsResponse
$creadPrec :: ReadPrec ListObjectsResponse
readList :: ReadS [ListObjectsResponse]
$creadList :: ReadS [ListObjectsResponse]
readsPrec :: Int -> ReadS ListObjectsResponse
$creadsPrec :: Int -> ReadS ListObjectsResponse
Prelude.Read, Int -> ListObjectsResponse -> ShowS
[ListObjectsResponse] -> ShowS
ListObjectsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListObjectsResponse] -> ShowS
$cshowList :: [ListObjectsResponse] -> ShowS
show :: ListObjectsResponse -> String
$cshow :: ListObjectsResponse -> String
showsPrec :: Int -> ListObjectsResponse -> ShowS
$cshowsPrec :: Int -> ListObjectsResponse -> ShowS
Prelude.Show, forall x. Rep ListObjectsResponse x -> ListObjectsResponse
forall x. ListObjectsResponse -> Rep ListObjectsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListObjectsResponse x -> ListObjectsResponse
$cfrom :: forall x. ListObjectsResponse -> Rep ListObjectsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListObjectsResponse' 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:
--
-- 'commonPrefixes', 'listObjectsResponse_commonPrefixes' - All of the keys (up to 1,000) rolled up in a common prefix count as a
-- single return when calculating the number of returns.
--
-- A response can contain CommonPrefixes only if you specify a delimiter.
--
-- CommonPrefixes contains all (if there are any) keys between Prefix and
-- the next occurrence of the string specified by the delimiter.
--
-- CommonPrefixes lists keys that act like subdirectories in the directory
-- specified by Prefix.
--
-- For example, if the prefix is notes\/ and the delimiter is a slash (\/)
-- as in notes\/summer\/july, the common prefix is notes\/summer\/. All of
-- the keys that roll up into a common prefix count as a single return when
-- calculating the number of returns.
--
-- 'contents', 'listObjectsResponse_contents' - Metadata about each object returned.
--
-- 'delimiter', 'listObjectsResponse_delimiter' - Causes keys that contain the same string between the prefix and the
-- first occurrence of the delimiter to be rolled up into a single result
-- element in the @CommonPrefixes@ collection. These rolled-up keys are not
-- returned elsewhere in the response. Each rolled-up result counts as only
-- one return against the @MaxKeys@ value.
--
-- 'encodingType', 'listObjectsResponse_encodingType' - Encoding type used by Amazon S3 to encode object keys in the response.
--
-- 'isTruncated', 'listObjectsResponse_isTruncated' - A flag that indicates whether Amazon S3 returned all of the results that
-- satisfied the search criteria.
--
-- 'marker', 'listObjectsResponse_marker' - Indicates where in the bucket listing begins. Marker is included in the
-- response if it was sent with the request.
--
-- 'maxKeys', 'listObjectsResponse_maxKeys' - The maximum number of keys returned in the response body.
--
-- 'name', 'listObjectsResponse_name' - The bucket name.
--
-- 'nextMarker', 'listObjectsResponse_nextMarker' - When response is truncated (the IsTruncated element value in the
-- response is true), you can use the key name in this field as marker in
-- the subsequent request to get next set of objects. Amazon S3 lists
-- objects in alphabetical order Note: This element is returned only if you
-- have delimiter request parameter specified. If response does not include
-- the NextMarker and it is truncated, you can use the value of the last
-- Key in the response as the marker in the subsequent request to get the
-- next set of object keys.
--
-- 'prefix', 'listObjectsResponse_prefix' - Keys that begin with the indicated prefix.
--
-- 'httpStatus', 'listObjectsResponse_httpStatus' - The response's http status code.
newListObjectsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListObjectsResponse
newListObjectsResponse :: Int -> ListObjectsResponse
newListObjectsResponse Int
pHttpStatus_ =
  ListObjectsResponse'
    { $sel:commonPrefixes:ListObjectsResponse' :: Maybe [CommonPrefix]
commonPrefixes =
        forall a. Maybe a
Prelude.Nothing,
      $sel:contents:ListObjectsResponse' :: Maybe [Object]
contents = forall a. Maybe a
Prelude.Nothing,
      $sel:delimiter:ListObjectsResponse' :: Maybe Delimiter
delimiter = forall a. Maybe a
Prelude.Nothing,
      $sel:encodingType:ListObjectsResponse' :: Maybe EncodingType
encodingType = forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListObjectsResponse' :: Maybe Bool
isTruncated = forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListObjectsResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:maxKeys:ListObjectsResponse' :: Maybe Int
maxKeys = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ListObjectsResponse' :: Maybe BucketName
name = forall a. Maybe a
Prelude.Nothing,
      $sel:nextMarker:ListObjectsResponse' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing,
      $sel:prefix:ListObjectsResponse' :: Maybe Text
prefix = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListObjectsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | All of the keys (up to 1,000) rolled up in a common prefix count as a
-- single return when calculating the number of returns.
--
-- A response can contain CommonPrefixes only if you specify a delimiter.
--
-- CommonPrefixes contains all (if there are any) keys between Prefix and
-- the next occurrence of the string specified by the delimiter.
--
-- CommonPrefixes lists keys that act like subdirectories in the directory
-- specified by Prefix.
--
-- For example, if the prefix is notes\/ and the delimiter is a slash (\/)
-- as in notes\/summer\/july, the common prefix is notes\/summer\/. All of
-- the keys that roll up into a common prefix count as a single return when
-- calculating the number of returns.
listObjectsResponse_commonPrefixes :: Lens.Lens' ListObjectsResponse (Prelude.Maybe [CommonPrefix])
listObjectsResponse_commonPrefixes :: Lens' ListObjectsResponse (Maybe [CommonPrefix])
listObjectsResponse_commonPrefixes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Maybe [CommonPrefix]
commonPrefixes :: Maybe [CommonPrefix]
$sel:commonPrefixes:ListObjectsResponse' :: ListObjectsResponse -> Maybe [CommonPrefix]
commonPrefixes} -> Maybe [CommonPrefix]
commonPrefixes) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Maybe [CommonPrefix]
a -> ListObjectsResponse
s {$sel:commonPrefixes:ListObjectsResponse' :: Maybe [CommonPrefix]
commonPrefixes = Maybe [CommonPrefix]
a} :: ListObjectsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Metadata about each object returned.
listObjectsResponse_contents :: Lens.Lens' ListObjectsResponse (Prelude.Maybe [Object])
listObjectsResponse_contents :: Lens' ListObjectsResponse (Maybe [Object])
listObjectsResponse_contents = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Maybe [Object]
contents :: Maybe [Object]
$sel:contents:ListObjectsResponse' :: ListObjectsResponse -> Maybe [Object]
contents} -> Maybe [Object]
contents) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Maybe [Object]
a -> ListObjectsResponse
s {$sel:contents:ListObjectsResponse' :: Maybe [Object]
contents = Maybe [Object]
a} :: ListObjectsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Causes keys that contain the same string between the prefix and the
-- first occurrence of the delimiter to be rolled up into a single result
-- element in the @CommonPrefixes@ collection. These rolled-up keys are not
-- returned elsewhere in the response. Each rolled-up result counts as only
-- one return against the @MaxKeys@ value.
listObjectsResponse_delimiter :: Lens.Lens' ListObjectsResponse (Prelude.Maybe Delimiter)
listObjectsResponse_delimiter :: Lens' ListObjectsResponse (Maybe Delimiter)
listObjectsResponse_delimiter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Maybe Delimiter
delimiter :: Maybe Delimiter
$sel:delimiter:ListObjectsResponse' :: ListObjectsResponse -> Maybe Delimiter
delimiter} -> Maybe Delimiter
delimiter) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Maybe Delimiter
a -> ListObjectsResponse
s {$sel:delimiter:ListObjectsResponse' :: Maybe Delimiter
delimiter = Maybe Delimiter
a} :: ListObjectsResponse)

-- | Encoding type used by Amazon S3 to encode object keys in the response.
listObjectsResponse_encodingType :: Lens.Lens' ListObjectsResponse (Prelude.Maybe EncodingType)
listObjectsResponse_encodingType :: Lens' ListObjectsResponse (Maybe EncodingType)
listObjectsResponse_encodingType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Maybe EncodingType
encodingType :: Maybe EncodingType
$sel:encodingType:ListObjectsResponse' :: ListObjectsResponse -> Maybe EncodingType
encodingType} -> Maybe EncodingType
encodingType) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Maybe EncodingType
a -> ListObjectsResponse
s {$sel:encodingType:ListObjectsResponse' :: Maybe EncodingType
encodingType = Maybe EncodingType
a} :: ListObjectsResponse)

-- | A flag that indicates whether Amazon S3 returned all of the results that
-- satisfied the search criteria.
listObjectsResponse_isTruncated :: Lens.Lens' ListObjectsResponse (Prelude.Maybe Prelude.Bool)
listObjectsResponse_isTruncated :: Lens' ListObjectsResponse (Maybe Bool)
listObjectsResponse_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListObjectsResponse' :: ListObjectsResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Maybe Bool
a -> ListObjectsResponse
s {$sel:isTruncated:ListObjectsResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListObjectsResponse)

-- | Indicates where in the bucket listing begins. Marker is included in the
-- response if it was sent with the request.
listObjectsResponse_marker :: Lens.Lens' ListObjectsResponse (Prelude.Maybe Prelude.Text)
listObjectsResponse_marker :: Lens' ListObjectsResponse (Maybe Text)
listObjectsResponse_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListObjectsResponse' :: ListObjectsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Maybe Text
a -> ListObjectsResponse
s {$sel:marker:ListObjectsResponse' :: Maybe Text
marker = Maybe Text
a} :: ListObjectsResponse)

-- | The maximum number of keys returned in the response body.
listObjectsResponse_maxKeys :: Lens.Lens' ListObjectsResponse (Prelude.Maybe Prelude.Int)
listObjectsResponse_maxKeys :: Lens' ListObjectsResponse (Maybe Int)
listObjectsResponse_maxKeys = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Maybe Int
maxKeys :: Maybe Int
$sel:maxKeys:ListObjectsResponse' :: ListObjectsResponse -> Maybe Int
maxKeys} -> Maybe Int
maxKeys) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Maybe Int
a -> ListObjectsResponse
s {$sel:maxKeys:ListObjectsResponse' :: Maybe Int
maxKeys = Maybe Int
a} :: ListObjectsResponse)

-- | The bucket name.
listObjectsResponse_name :: Lens.Lens' ListObjectsResponse (Prelude.Maybe BucketName)
listObjectsResponse_name :: Lens' ListObjectsResponse (Maybe BucketName)
listObjectsResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Maybe BucketName
name :: Maybe BucketName
$sel:name:ListObjectsResponse' :: ListObjectsResponse -> Maybe BucketName
name} -> Maybe BucketName
name) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Maybe BucketName
a -> ListObjectsResponse
s {$sel:name:ListObjectsResponse' :: Maybe BucketName
name = Maybe BucketName
a} :: ListObjectsResponse)

-- | When response is truncated (the IsTruncated element value in the
-- response is true), you can use the key name in this field as marker in
-- the subsequent request to get next set of objects. Amazon S3 lists
-- objects in alphabetical order Note: This element is returned only if you
-- have delimiter request parameter specified. If response does not include
-- the NextMarker and it is truncated, you can use the value of the last
-- Key in the response as the marker in the subsequent request to get the
-- next set of object keys.
listObjectsResponse_nextMarker :: Lens.Lens' ListObjectsResponse (Prelude.Maybe Prelude.Text)
listObjectsResponse_nextMarker :: Lens' ListObjectsResponse (Maybe Text)
listObjectsResponse_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListObjectsResponse' :: ListObjectsResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Maybe Text
a -> ListObjectsResponse
s {$sel:nextMarker:ListObjectsResponse' :: Maybe Text
nextMarker = Maybe Text
a} :: ListObjectsResponse)

-- | Keys that begin with the indicated prefix.
listObjectsResponse_prefix :: Lens.Lens' ListObjectsResponse (Prelude.Maybe Prelude.Text)
listObjectsResponse_prefix :: Lens' ListObjectsResponse (Maybe Text)
listObjectsResponse_prefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Maybe Text
prefix :: Maybe Text
$sel:prefix:ListObjectsResponse' :: ListObjectsResponse -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Maybe Text
a -> ListObjectsResponse
s {$sel:prefix:ListObjectsResponse' :: Maybe Text
prefix = Maybe Text
a} :: ListObjectsResponse)

-- | The response's http status code.
listObjectsResponse_httpStatus :: Lens.Lens' ListObjectsResponse Prelude.Int
listObjectsResponse_httpStatus :: Lens' ListObjectsResponse Int
listObjectsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListObjectsResponse' :: ListObjectsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListObjectsResponse
s@ListObjectsResponse' {} Int
a -> ListObjectsResponse
s {$sel:httpStatus:ListObjectsResponse' :: Int
httpStatus = Int
a} :: ListObjectsResponse)

instance Prelude.NFData ListObjectsResponse where
  rnf :: ListObjectsResponse -> ()
rnf ListObjectsResponse' {Int
Maybe Bool
Maybe Delimiter
Maybe Int
Maybe [CommonPrefix]
Maybe [Object]
Maybe Text
Maybe BucketName
Maybe EncodingType
httpStatus :: Int
prefix :: Maybe Text
nextMarker :: Maybe Text
name :: Maybe BucketName
maxKeys :: Maybe Int
marker :: Maybe Text
isTruncated :: Maybe Bool
encodingType :: Maybe EncodingType
delimiter :: Maybe Delimiter
contents :: Maybe [Object]
commonPrefixes :: Maybe [CommonPrefix]
$sel:httpStatus:ListObjectsResponse' :: ListObjectsResponse -> Int
$sel:prefix:ListObjectsResponse' :: ListObjectsResponse -> Maybe Text
$sel:nextMarker:ListObjectsResponse' :: ListObjectsResponse -> Maybe Text
$sel:name:ListObjectsResponse' :: ListObjectsResponse -> Maybe BucketName
$sel:maxKeys:ListObjectsResponse' :: ListObjectsResponse -> Maybe Int
$sel:marker:ListObjectsResponse' :: ListObjectsResponse -> Maybe Text
$sel:isTruncated:ListObjectsResponse' :: ListObjectsResponse -> Maybe Bool
$sel:encodingType:ListObjectsResponse' :: ListObjectsResponse -> Maybe EncodingType
$sel:delimiter:ListObjectsResponse' :: ListObjectsResponse -> Maybe Delimiter
$sel:contents:ListObjectsResponse' :: ListObjectsResponse -> Maybe [Object]
$sel:commonPrefixes:ListObjectsResponse' :: ListObjectsResponse -> Maybe [CommonPrefix]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [CommonPrefix]
commonPrefixes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Object]
contents
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Delimiter
delimiter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EncodingType
encodingType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isTruncated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxKeys
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BucketName
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextMarker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
prefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus