{-# 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.ListObjectsV2
-- 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)
--
-- Returns some or all (up to 1,000) of the objects in a bucket with each
-- request. 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. Make sure to design your application to
-- parse the contents of the response and handle it appropriately. Objects
-- are returned sorted in an ascending order of the respective key names in
-- the list. For more information about listing objects, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/ListingKeysUsingAPIs.html Listing object keys programmatically>
--
-- To use this operation, you must have READ access to the bucket.
--
-- To use this action in an Identity and Access Management (IAM) policy,
-- you must have permissions to perform the @s3:ListBucket@ action. The
-- bucket owner has this permission by default and can grant this
-- permission to others. For more information about permissions, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources Permissions Related to Bucket Subresource Operations>
-- and
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html Managing Access Permissions to Your Amazon S3 Resources>.
--
-- This section describes the latest revision of this action. We recommend
-- that you use this revised API for application development. For backward
-- compatibility, Amazon S3 continues to support the prior version of this
-- API,
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html ListObjects>.
--
-- To get a list of your buckets, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html ListBuckets>.
--
-- The following operations are related to @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>
--
-- This operation returns paginated results.
module Amazonka.S3.ListObjectsV2
  ( -- * Creating a Request
    ListObjectsV2 (..),
    newListObjectsV2,

    -- * Request Lenses
    listObjectsV2_startAfter,
    listObjectsV2_continuationToken,
    listObjectsV2_fetchOwner,
    listObjectsV2_prefix,
    listObjectsV2_encodingType,
    listObjectsV2_requestPayer,
    listObjectsV2_maxKeys,
    listObjectsV2_delimiter,
    listObjectsV2_expectedBucketOwner,
    listObjectsV2_bucket,

    -- * Destructuring the Response
    ListObjectsV2Response (..),
    newListObjectsV2Response,

    -- * Response Lenses
    listObjectsV2Response_startAfter,
    listObjectsV2Response_keyCount,
    listObjectsV2Response_contents,
    listObjectsV2Response_continuationToken,
    listObjectsV2Response_prefix,
    listObjectsV2Response_commonPrefixes,
    listObjectsV2Response_encodingType,
    listObjectsV2Response_name,
    listObjectsV2Response_nextContinuationToken,
    listObjectsV2Response_maxKeys,
    listObjectsV2Response_isTruncated,
    listObjectsV2Response_delimiter,
    listObjectsV2Response_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.S3.Types

-- | /See:/ 'newListObjectsV2' smart constructor.
data ListObjectsV2 = ListObjectsV2'
  { -- | StartAfter is where you want Amazon S3 to start listing from. Amazon S3
    -- starts listing after this specified key. StartAfter can be any key in
    -- the bucket.
    ListObjectsV2 -> Maybe Text
startAfter :: Prelude.Maybe Prelude.Text,
    -- | ContinuationToken indicates Amazon S3 that the list is being continued
    -- on this bucket with a token. ContinuationToken is obfuscated and is not
    -- a real key.
    ListObjectsV2 -> Maybe Text
continuationToken :: Prelude.Maybe Prelude.Text,
    -- | The owner field is not present in listV2 by default, if you want to
    -- return owner field with each key in the result then set the fetch owner
    -- field to true.
    ListObjectsV2 -> Maybe Bool
fetchOwner :: Prelude.Maybe Prelude.Bool,
    -- | Limits the response to keys that begin with the specified prefix.
    ListObjectsV2 -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
    -- | Encoding type used by Amazon S3 to encode object keys in the response.
    ListObjectsV2 -> Maybe EncodingType
encodingType :: Prelude.Maybe EncodingType,
    -- | Confirms that the requester knows that she or he will be charged for the
    -- list objects request in V2 style. Bucket owners need not specify this
    -- parameter in their requests.
    ListObjectsV2 -> Maybe RequestPayer
requestPayer :: Prelude.Maybe RequestPayer,
    -- | 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.
    ListObjectsV2 -> Maybe Int
maxKeys :: Prelude.Maybe Prelude.Int,
    -- | A delimiter is a character you use to group keys.
    ListObjectsV2 -> Maybe Delimiter
delimiter :: Prelude.Maybe Delimiter,
    -- | The account ID of the expected bucket owner. If the bucket is owned by a
    -- different account, the request will fail with an HTTP
    -- @403 (Access Denied)@ error.
    ListObjectsV2 -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | Bucket name to list.
    --
    -- 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 using 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 S3 on Outposts>
    -- in the /Amazon S3 User Guide/.
    ListObjectsV2 -> BucketName
bucket :: BucketName
  }
  deriving (ListObjectsV2 -> ListObjectsV2 -> Bool
(ListObjectsV2 -> ListObjectsV2 -> Bool)
-> (ListObjectsV2 -> ListObjectsV2 -> Bool) -> Eq ListObjectsV2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListObjectsV2 -> ListObjectsV2 -> Bool
$c/= :: ListObjectsV2 -> ListObjectsV2 -> Bool
== :: ListObjectsV2 -> ListObjectsV2 -> Bool
$c== :: ListObjectsV2 -> ListObjectsV2 -> Bool
Prelude.Eq, ReadPrec [ListObjectsV2]
ReadPrec ListObjectsV2
Int -> ReadS ListObjectsV2
ReadS [ListObjectsV2]
(Int -> ReadS ListObjectsV2)
-> ReadS [ListObjectsV2]
-> ReadPrec ListObjectsV2
-> ReadPrec [ListObjectsV2]
-> Read ListObjectsV2
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListObjectsV2]
$creadListPrec :: ReadPrec [ListObjectsV2]
readPrec :: ReadPrec ListObjectsV2
$creadPrec :: ReadPrec ListObjectsV2
readList :: ReadS [ListObjectsV2]
$creadList :: ReadS [ListObjectsV2]
readsPrec :: Int -> ReadS ListObjectsV2
$creadsPrec :: Int -> ReadS ListObjectsV2
Prelude.Read, Int -> ListObjectsV2 -> ShowS
[ListObjectsV2] -> ShowS
ListObjectsV2 -> String
(Int -> ListObjectsV2 -> ShowS)
-> (ListObjectsV2 -> String)
-> ([ListObjectsV2] -> ShowS)
-> Show ListObjectsV2
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListObjectsV2] -> ShowS
$cshowList :: [ListObjectsV2] -> ShowS
show :: ListObjectsV2 -> String
$cshow :: ListObjectsV2 -> String
showsPrec :: Int -> ListObjectsV2 -> ShowS
$cshowsPrec :: Int -> ListObjectsV2 -> ShowS
Prelude.Show, (forall x. ListObjectsV2 -> Rep ListObjectsV2 x)
-> (forall x. Rep ListObjectsV2 x -> ListObjectsV2)
-> Generic ListObjectsV2
forall x. Rep ListObjectsV2 x -> ListObjectsV2
forall x. ListObjectsV2 -> Rep ListObjectsV2 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListObjectsV2 x -> ListObjectsV2
$cfrom :: forall x. ListObjectsV2 -> Rep ListObjectsV2 x
Prelude.Generic)

-- |
-- Create a value of 'ListObjectsV2' 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:
--
-- 'startAfter', 'listObjectsV2_startAfter' - StartAfter is where you want Amazon S3 to start listing from. Amazon S3
-- starts listing after this specified key. StartAfter can be any key in
-- the bucket.
--
-- 'continuationToken', 'listObjectsV2_continuationToken' - ContinuationToken indicates Amazon S3 that the list is being continued
-- on this bucket with a token. ContinuationToken is obfuscated and is not
-- a real key.
--
-- 'fetchOwner', 'listObjectsV2_fetchOwner' - The owner field is not present in listV2 by default, if you want to
-- return owner field with each key in the result then set the fetch owner
-- field to true.
--
-- 'prefix', 'listObjectsV2_prefix' - Limits the response to keys that begin with the specified prefix.
--
-- 'encodingType', 'listObjectsV2_encodingType' - Encoding type used by Amazon S3 to encode object keys in the response.
--
-- 'requestPayer', 'listObjectsV2_requestPayer' - Confirms that the requester knows that she or he will be charged for the
-- list objects request in V2 style. Bucket owners need not specify this
-- parameter in their requests.
--
-- 'maxKeys', 'listObjectsV2_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.
--
-- 'delimiter', 'listObjectsV2_delimiter' - A delimiter is a character you use to group keys.
--
-- 'expectedBucketOwner', 'listObjectsV2_expectedBucketOwner' - The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request will fail with an HTTP
-- @403 (Access Denied)@ error.
--
-- 'bucket', 'listObjectsV2_bucket' - Bucket name to list.
--
-- 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 using 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 S3 on Outposts>
-- in the /Amazon S3 User Guide/.
newListObjectsV2 ::
  -- | 'bucket'
  BucketName ->
  ListObjectsV2
newListObjectsV2 :: BucketName -> ListObjectsV2
newListObjectsV2 BucketName
pBucket_ =
  ListObjectsV2' :: Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe EncodingType
-> Maybe RequestPayer
-> Maybe Int
-> Maybe Delimiter
-> Maybe Text
-> BucketName
-> ListObjectsV2
ListObjectsV2'
    { $sel:startAfter:ListObjectsV2' :: Maybe Text
startAfter = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:continuationToken:ListObjectsV2' :: Maybe Text
continuationToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fetchOwner:ListObjectsV2' :: Maybe Bool
fetchOwner = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:prefix:ListObjectsV2' :: Maybe Text
prefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:encodingType:ListObjectsV2' :: Maybe EncodingType
encodingType = Maybe EncodingType
forall a. Maybe a
Prelude.Nothing,
      $sel:requestPayer:ListObjectsV2' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
forall a. Maybe a
Prelude.Nothing,
      $sel:maxKeys:ListObjectsV2' :: Maybe Int
maxKeys = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:delimiter:ListObjectsV2' :: Maybe Delimiter
delimiter = Maybe Delimiter
forall a. Maybe a
Prelude.Nothing,
      $sel:expectedBucketOwner:ListObjectsV2' :: Maybe Text
expectedBucketOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:ListObjectsV2' :: BucketName
bucket = BucketName
pBucket_
    }

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

-- | ContinuationToken indicates Amazon S3 that the list is being continued
-- on this bucket with a token. ContinuationToken is obfuscated and is not
-- a real key.
listObjectsV2_continuationToken :: Lens.Lens' ListObjectsV2 (Prelude.Maybe Prelude.Text)
listObjectsV2_continuationToken :: (Maybe Text -> f (Maybe Text)) -> ListObjectsV2 -> f ListObjectsV2
listObjectsV2_continuationToken = (ListObjectsV2 -> Maybe Text)
-> (ListObjectsV2 -> Maybe Text -> ListObjectsV2)
-> Lens ListObjectsV2 ListObjectsV2 (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2' {Maybe Text
continuationToken :: Maybe Text
$sel:continuationToken:ListObjectsV2' :: ListObjectsV2 -> Maybe Text
continuationToken} -> Maybe Text
continuationToken) (\s :: ListObjectsV2
s@ListObjectsV2' {} Maybe Text
a -> ListObjectsV2
s {$sel:continuationToken:ListObjectsV2' :: Maybe Text
continuationToken = Maybe Text
a} :: ListObjectsV2)

-- | The owner field is not present in listV2 by default, if you want to
-- return owner field with each key in the result then set the fetch owner
-- field to true.
listObjectsV2_fetchOwner :: Lens.Lens' ListObjectsV2 (Prelude.Maybe Prelude.Bool)
listObjectsV2_fetchOwner :: (Maybe Bool -> f (Maybe Bool)) -> ListObjectsV2 -> f ListObjectsV2
listObjectsV2_fetchOwner = (ListObjectsV2 -> Maybe Bool)
-> (ListObjectsV2 -> Maybe Bool -> ListObjectsV2)
-> Lens ListObjectsV2 ListObjectsV2 (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2' {Maybe Bool
fetchOwner :: Maybe Bool
$sel:fetchOwner:ListObjectsV2' :: ListObjectsV2 -> Maybe Bool
fetchOwner} -> Maybe Bool
fetchOwner) (\s :: ListObjectsV2
s@ListObjectsV2' {} Maybe Bool
a -> ListObjectsV2
s {$sel:fetchOwner:ListObjectsV2' :: Maybe Bool
fetchOwner = Maybe Bool
a} :: ListObjectsV2)

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

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

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

-- | 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.
listObjectsV2_maxKeys :: Lens.Lens' ListObjectsV2 (Prelude.Maybe Prelude.Int)
listObjectsV2_maxKeys :: (Maybe Int -> f (Maybe Int)) -> ListObjectsV2 -> f ListObjectsV2
listObjectsV2_maxKeys = (ListObjectsV2 -> Maybe Int)
-> (ListObjectsV2 -> Maybe Int -> ListObjectsV2)
-> Lens ListObjectsV2 ListObjectsV2 (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2' {Maybe Int
maxKeys :: Maybe Int
$sel:maxKeys:ListObjectsV2' :: ListObjectsV2 -> Maybe Int
maxKeys} -> Maybe Int
maxKeys) (\s :: ListObjectsV2
s@ListObjectsV2' {} Maybe Int
a -> ListObjectsV2
s {$sel:maxKeys:ListObjectsV2' :: Maybe Int
maxKeys = Maybe Int
a} :: ListObjectsV2)

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

-- | The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request will fail with an HTTP
-- @403 (Access Denied)@ error.
listObjectsV2_expectedBucketOwner :: Lens.Lens' ListObjectsV2 (Prelude.Maybe Prelude.Text)
listObjectsV2_expectedBucketOwner :: (Maybe Text -> f (Maybe Text)) -> ListObjectsV2 -> f ListObjectsV2
listObjectsV2_expectedBucketOwner = (ListObjectsV2 -> Maybe Text)
-> (ListObjectsV2 -> Maybe Text -> ListObjectsV2)
-> Lens ListObjectsV2 ListObjectsV2 (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:ListObjectsV2' :: ListObjectsV2 -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: ListObjectsV2
s@ListObjectsV2' {} Maybe Text
a -> ListObjectsV2
s {$sel:expectedBucketOwner:ListObjectsV2' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: ListObjectsV2)

-- | Bucket name to list.
--
-- 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 using 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 S3 on Outposts>
-- in the /Amazon S3 User Guide/.
listObjectsV2_bucket :: Lens.Lens' ListObjectsV2 BucketName
listObjectsV2_bucket :: (BucketName -> f BucketName) -> ListObjectsV2 -> f ListObjectsV2
listObjectsV2_bucket = (ListObjectsV2 -> BucketName)
-> (ListObjectsV2 -> BucketName -> ListObjectsV2)
-> Lens ListObjectsV2 ListObjectsV2 BucketName BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2' {BucketName
bucket :: BucketName
$sel:bucket:ListObjectsV2' :: ListObjectsV2 -> BucketName
bucket} -> BucketName
bucket) (\s :: ListObjectsV2
s@ListObjectsV2' {} BucketName
a -> ListObjectsV2
s {$sel:bucket:ListObjectsV2' :: BucketName
bucket = BucketName
a} :: ListObjectsV2)

instance Core.AWSPager ListObjectsV2 where
  page :: ListObjectsV2 -> AWSResponse ListObjectsV2 -> Maybe ListObjectsV2
page ListObjectsV2
rq AWSResponse ListObjectsV2
rs
    | Maybe Bool -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListObjectsV2
ListObjectsV2Response
rs
            ListObjectsV2Response
-> Getting (First Bool) ListObjectsV2Response Bool -> Maybe Bool
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Bool -> Const (First Bool) (Maybe Bool))
-> ListObjectsV2Response
-> Const (First Bool) ListObjectsV2Response
Lens' ListObjectsV2Response (Maybe Bool)
listObjectsV2Response_isTruncated
              ((Maybe Bool -> Const (First Bool) (Maybe Bool))
 -> ListObjectsV2Response
 -> Const (First Bool) ListObjectsV2Response)
-> ((Bool -> Const (First Bool) Bool)
    -> Maybe Bool -> Const (First Bool) (Maybe Bool))
-> Getting (First Bool) ListObjectsV2Response Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Bool -> Const (First Bool) Bool)
-> Maybe Bool -> Const (First Bool) (Maybe Bool)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListObjectsV2
forall a. Maybe a
Prelude.Nothing
    | Maybe Text -> Bool
forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListObjectsV2
ListObjectsV2Response
rs
            ListObjectsV2Response
-> Getting (First Text) ListObjectsV2Response Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListObjectsV2Response
-> Const (First Text) ListObjectsV2Response
Lens' ListObjectsV2Response (Maybe Text)
listObjectsV2Response_nextContinuationToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListObjectsV2Response
 -> Const (First Text) ListObjectsV2Response)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListObjectsV2Response Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListObjectsV2
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListObjectsV2 -> Maybe ListObjectsV2
forall a. a -> Maybe a
Prelude.Just (ListObjectsV2 -> Maybe ListObjectsV2)
-> ListObjectsV2 -> Maybe ListObjectsV2
forall a b. (a -> b) -> a -> b
Prelude.$
        ListObjectsV2
rq
          ListObjectsV2 -> (ListObjectsV2 -> ListObjectsV2) -> ListObjectsV2
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListObjectsV2 -> Identity ListObjectsV2
Lens ListObjectsV2 ListObjectsV2 (Maybe Text) (Maybe Text)
listObjectsV2_continuationToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListObjectsV2 -> Identity ListObjectsV2)
-> Maybe Text -> ListObjectsV2 -> ListObjectsV2
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListObjectsV2
ListObjectsV2Response
rs
          ListObjectsV2Response
-> Getting (First Text) ListObjectsV2Response Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListObjectsV2Response
-> Const (First Text) ListObjectsV2Response
Lens' ListObjectsV2Response (Maybe Text)
listObjectsV2Response_nextContinuationToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListObjectsV2Response
 -> Const (First Text) ListObjectsV2Response)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListObjectsV2Response Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

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

instance Prelude.Hashable ListObjectsV2

instance Prelude.NFData ListObjectsV2

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

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

instance Core.ToQuery ListObjectsV2 where
  toQuery :: ListObjectsV2 -> QueryString
toQuery ListObjectsV2' {Maybe Bool
Maybe Delimiter
Maybe Int
Maybe Text
Maybe EncodingType
Maybe RequestPayer
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
delimiter :: Maybe Delimiter
maxKeys :: Maybe Int
requestPayer :: Maybe RequestPayer
encodingType :: Maybe EncodingType
prefix :: Maybe Text
fetchOwner :: Maybe Bool
continuationToken :: Maybe Text
startAfter :: Maybe Text
$sel:bucket:ListObjectsV2' :: ListObjectsV2 -> BucketName
$sel:expectedBucketOwner:ListObjectsV2' :: ListObjectsV2 -> Maybe Text
$sel:delimiter:ListObjectsV2' :: ListObjectsV2 -> Maybe Delimiter
$sel:maxKeys:ListObjectsV2' :: ListObjectsV2 -> Maybe Int
$sel:requestPayer:ListObjectsV2' :: ListObjectsV2 -> Maybe RequestPayer
$sel:encodingType:ListObjectsV2' :: ListObjectsV2 -> Maybe EncodingType
$sel:prefix:ListObjectsV2' :: ListObjectsV2 -> Maybe Text
$sel:fetchOwner:ListObjectsV2' :: ListObjectsV2 -> Maybe Bool
$sel:continuationToken:ListObjectsV2' :: ListObjectsV2 -> Maybe Text
$sel:startAfter:ListObjectsV2' :: ListObjectsV2 -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"start-after" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
startAfter,
        ByteString
"continuation-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
continuationToken,
        ByteString
"fetch-owner" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
fetchOwner,
        ByteString
"prefix" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
prefix,
        ByteString
"encoding-type" ByteString -> Maybe EncodingType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe EncodingType
encodingType,
        ByteString
"max-keys" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxKeys,
        ByteString
"delimiter" ByteString -> Maybe Delimiter -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Delimiter
delimiter,
        QueryString
"list-type=2"
      ]

-- | /See:/ 'newListObjectsV2Response' smart constructor.
data ListObjectsV2Response = ListObjectsV2Response'
  { -- | If StartAfter was sent with the request, it is included in the response.
    ListObjectsV2Response -> Maybe Text
startAfter :: Prelude.Maybe Prelude.Text,
    -- | KeyCount is the number of keys returned with this request. KeyCount will
    -- always be less than or equals to MaxKeys field. Say you ask for 50 keys,
    -- your result will include less than equals 50 keys
    ListObjectsV2Response -> Maybe Int
keyCount :: Prelude.Maybe Prelude.Int,
    -- | Metadata about each object returned.
    ListObjectsV2Response -> Maybe [Object]
contents :: Prelude.Maybe [Object],
    -- | If ContinuationToken was sent with the request, it is included in the
    -- response.
    ListObjectsV2Response -> Maybe Text
continuationToken :: Prelude.Maybe Prelude.Text,
    -- | Keys that begin with the indicated prefix.
    ListObjectsV2Response -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
    -- | All of the keys (up to 1,000) rolled up into 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 a 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.
    ListObjectsV2Response -> Maybe [CommonPrefix]
commonPrefixes :: Prelude.Maybe [CommonPrefix],
    -- | Encoding type used by Amazon S3 to encode object key names in the XML
    -- response.
    --
    -- If you specify the encoding-type request parameter, Amazon S3 includes
    -- this element in the response, and returns encoded key name values in the
    -- following response elements:
    --
    -- @Delimiter, Prefix, Key,@ and @StartAfter@.
    ListObjectsV2Response -> Maybe EncodingType
encodingType :: Prelude.Maybe EncodingType,
    -- | The bucket name.
    --
    -- 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 using 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 S3 on Outposts>
    -- in the /Amazon S3 User Guide/.
    ListObjectsV2Response -> Maybe BucketName
name :: Prelude.Maybe BucketName,
    -- | @NextContinuationToken@ is sent when @isTruncated@ is true, which means
    -- there are more keys in the bucket that can be listed. The next list
    -- requests to Amazon S3 can be continued with this
    -- @NextContinuationToken@. @NextContinuationToken@ is obfuscated and is
    -- not a real key
    ListObjectsV2Response -> Maybe Text
nextContinuationToken :: 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.
    ListObjectsV2Response -> Maybe Int
maxKeys :: Prelude.Maybe Prelude.Int,
    -- | Set to false if all of the results were returned. Set to true if more
    -- keys are available to return. If the number of results exceeds that
    -- specified by MaxKeys, all of the results might not be returned.
    ListObjectsV2Response -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | 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.
    ListObjectsV2Response -> Maybe Delimiter
delimiter :: Prelude.Maybe Delimiter,
    -- | The response's http status code.
    ListObjectsV2Response -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListObjectsV2Response -> ListObjectsV2Response -> Bool
(ListObjectsV2Response -> ListObjectsV2Response -> Bool)
-> (ListObjectsV2Response -> ListObjectsV2Response -> Bool)
-> Eq ListObjectsV2Response
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListObjectsV2Response -> ListObjectsV2Response -> Bool
$c/= :: ListObjectsV2Response -> ListObjectsV2Response -> Bool
== :: ListObjectsV2Response -> ListObjectsV2Response -> Bool
$c== :: ListObjectsV2Response -> ListObjectsV2Response -> Bool
Prelude.Eq, ReadPrec [ListObjectsV2Response]
ReadPrec ListObjectsV2Response
Int -> ReadS ListObjectsV2Response
ReadS [ListObjectsV2Response]
(Int -> ReadS ListObjectsV2Response)
-> ReadS [ListObjectsV2Response]
-> ReadPrec ListObjectsV2Response
-> ReadPrec [ListObjectsV2Response]
-> Read ListObjectsV2Response
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListObjectsV2Response]
$creadListPrec :: ReadPrec [ListObjectsV2Response]
readPrec :: ReadPrec ListObjectsV2Response
$creadPrec :: ReadPrec ListObjectsV2Response
readList :: ReadS [ListObjectsV2Response]
$creadList :: ReadS [ListObjectsV2Response]
readsPrec :: Int -> ReadS ListObjectsV2Response
$creadsPrec :: Int -> ReadS ListObjectsV2Response
Prelude.Read, Int -> ListObjectsV2Response -> ShowS
[ListObjectsV2Response] -> ShowS
ListObjectsV2Response -> String
(Int -> ListObjectsV2Response -> ShowS)
-> (ListObjectsV2Response -> String)
-> ([ListObjectsV2Response] -> ShowS)
-> Show ListObjectsV2Response
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListObjectsV2Response] -> ShowS
$cshowList :: [ListObjectsV2Response] -> ShowS
show :: ListObjectsV2Response -> String
$cshow :: ListObjectsV2Response -> String
showsPrec :: Int -> ListObjectsV2Response -> ShowS
$cshowsPrec :: Int -> ListObjectsV2Response -> ShowS
Prelude.Show, (forall x. ListObjectsV2Response -> Rep ListObjectsV2Response x)
-> (forall x. Rep ListObjectsV2Response x -> ListObjectsV2Response)
-> Generic ListObjectsV2Response
forall x. Rep ListObjectsV2Response x -> ListObjectsV2Response
forall x. ListObjectsV2Response -> Rep ListObjectsV2Response x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListObjectsV2Response x -> ListObjectsV2Response
$cfrom :: forall x. ListObjectsV2Response -> Rep ListObjectsV2Response x
Prelude.Generic)

-- |
-- Create a value of 'ListObjectsV2Response' 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:
--
-- 'startAfter', 'listObjectsV2Response_startAfter' - If StartAfter was sent with the request, it is included in the response.
--
-- 'keyCount', 'listObjectsV2Response_keyCount' - KeyCount is the number of keys returned with this request. KeyCount will
-- always be less than or equals to MaxKeys field. Say you ask for 50 keys,
-- your result will include less than equals 50 keys
--
-- 'contents', 'listObjectsV2Response_contents' - Metadata about each object returned.
--
-- 'continuationToken', 'listObjectsV2Response_continuationToken' - If ContinuationToken was sent with the request, it is included in the
-- response.
--
-- 'prefix', 'listObjectsV2Response_prefix' - Keys that begin with the indicated prefix.
--
-- 'commonPrefixes', 'listObjectsV2Response_commonPrefixes' - All of the keys (up to 1,000) rolled up into 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 a 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.
--
-- 'encodingType', 'listObjectsV2Response_encodingType' - Encoding type used by Amazon S3 to encode object key names in the XML
-- response.
--
-- If you specify the encoding-type request parameter, Amazon S3 includes
-- this element in the response, and returns encoded key name values in the
-- following response elements:
--
-- @Delimiter, Prefix, Key,@ and @StartAfter@.
--
-- 'name', 'listObjectsV2Response_name' - The bucket name.
--
-- 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 using 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 S3 on Outposts>
-- in the /Amazon S3 User Guide/.
--
-- 'nextContinuationToken', 'listObjectsV2Response_nextContinuationToken' - @NextContinuationToken@ is sent when @isTruncated@ is true, which means
-- there are more keys in the bucket that can be listed. The next list
-- requests to Amazon S3 can be continued with this
-- @NextContinuationToken@. @NextContinuationToken@ is obfuscated and is
-- not a real key
--
-- 'maxKeys', 'listObjectsV2Response_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.
--
-- 'isTruncated', 'listObjectsV2Response_isTruncated' - Set to false if all of the results were returned. Set to true if more
-- keys are available to return. If the number of results exceeds that
-- specified by MaxKeys, all of the results might not be returned.
--
-- 'delimiter', 'listObjectsV2Response_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.
--
-- 'httpStatus', 'listObjectsV2Response_httpStatus' - The response's http status code.
newListObjectsV2Response ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListObjectsV2Response
newListObjectsV2Response :: Int -> ListObjectsV2Response
newListObjectsV2Response Int
pHttpStatus_ =
  ListObjectsV2Response' :: Maybe Text
-> Maybe Int
-> Maybe [Object]
-> Maybe Text
-> Maybe Text
-> Maybe [CommonPrefix]
-> Maybe EncodingType
-> Maybe BucketName
-> Maybe Text
-> Maybe Int
-> Maybe Bool
-> Maybe Delimiter
-> Int
-> ListObjectsV2Response
ListObjectsV2Response'
    { $sel:startAfter:ListObjectsV2Response' :: Maybe Text
startAfter =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:keyCount:ListObjectsV2Response' :: Maybe Int
keyCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:contents:ListObjectsV2Response' :: Maybe [Object]
contents = Maybe [Object]
forall a. Maybe a
Prelude.Nothing,
      $sel:continuationToken:ListObjectsV2Response' :: Maybe Text
continuationToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:prefix:ListObjectsV2Response' :: Maybe Text
prefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:commonPrefixes:ListObjectsV2Response' :: Maybe [CommonPrefix]
commonPrefixes = Maybe [CommonPrefix]
forall a. Maybe a
Prelude.Nothing,
      $sel:encodingType:ListObjectsV2Response' :: Maybe EncodingType
encodingType = Maybe EncodingType
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ListObjectsV2Response' :: Maybe BucketName
name = Maybe BucketName
forall a. Maybe a
Prelude.Nothing,
      $sel:nextContinuationToken:ListObjectsV2Response' :: Maybe Text
nextContinuationToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxKeys:ListObjectsV2Response' :: Maybe Int
maxKeys = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListObjectsV2Response' :: Maybe Bool
isTruncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:delimiter:ListObjectsV2Response' :: Maybe Delimiter
delimiter = Maybe Delimiter
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListObjectsV2Response' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If StartAfter was sent with the request, it is included in the response.
listObjectsV2Response_startAfter :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe Prelude.Text)
listObjectsV2Response_startAfter :: (Maybe Text -> f (Maybe Text))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_startAfter = (ListObjectsV2Response -> Maybe Text)
-> (ListObjectsV2Response -> Maybe Text -> ListObjectsV2Response)
-> Lens' ListObjectsV2Response (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe Text
startAfter :: Maybe Text
$sel:startAfter:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe Text
startAfter} -> Maybe Text
startAfter) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe Text
a -> ListObjectsV2Response
s {$sel:startAfter:ListObjectsV2Response' :: Maybe Text
startAfter = Maybe Text
a} :: ListObjectsV2Response)

-- | KeyCount is the number of keys returned with this request. KeyCount will
-- always be less than or equals to MaxKeys field. Say you ask for 50 keys,
-- your result will include less than equals 50 keys
listObjectsV2Response_keyCount :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe Prelude.Int)
listObjectsV2Response_keyCount :: (Maybe Int -> f (Maybe Int))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_keyCount = (ListObjectsV2Response -> Maybe Int)
-> (ListObjectsV2Response -> Maybe Int -> ListObjectsV2Response)
-> Lens
     ListObjectsV2Response ListObjectsV2Response (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe Int
keyCount :: Maybe Int
$sel:keyCount:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe Int
keyCount} -> Maybe Int
keyCount) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe Int
a -> ListObjectsV2Response
s {$sel:keyCount:ListObjectsV2Response' :: Maybe Int
keyCount = Maybe Int
a} :: ListObjectsV2Response)

-- | Metadata about each object returned.
listObjectsV2Response_contents :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe [Object])
listObjectsV2Response_contents :: (Maybe [Object] -> f (Maybe [Object]))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_contents = (ListObjectsV2Response -> Maybe [Object])
-> (ListObjectsV2Response
    -> Maybe [Object] -> ListObjectsV2Response)
-> Lens
     ListObjectsV2Response
     ListObjectsV2Response
     (Maybe [Object])
     (Maybe [Object])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe [Object]
contents :: Maybe [Object]
$sel:contents:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe [Object]
contents} -> Maybe [Object]
contents) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe [Object]
a -> ListObjectsV2Response
s {$sel:contents:ListObjectsV2Response' :: Maybe [Object]
contents = Maybe [Object]
a} :: ListObjectsV2Response) ((Maybe [Object] -> f (Maybe [Object]))
 -> ListObjectsV2Response -> f ListObjectsV2Response)
-> ((Maybe [Object] -> f (Maybe [Object]))
    -> Maybe [Object] -> f (Maybe [Object]))
-> (Maybe [Object] -> f (Maybe [Object]))
-> ListObjectsV2Response
-> f ListObjectsV2Response
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Object] [Object] [Object] [Object]
-> Iso
     (Maybe [Object]) (Maybe [Object]) (Maybe [Object]) (Maybe [Object])
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 AnIso [Object] [Object] [Object] [Object]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If ContinuationToken was sent with the request, it is included in the
-- response.
listObjectsV2Response_continuationToken :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe Prelude.Text)
listObjectsV2Response_continuationToken :: (Maybe Text -> f (Maybe Text))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_continuationToken = (ListObjectsV2Response -> Maybe Text)
-> (ListObjectsV2Response -> Maybe Text -> ListObjectsV2Response)
-> Lens' ListObjectsV2Response (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe Text
continuationToken :: Maybe Text
$sel:continuationToken:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe Text
continuationToken} -> Maybe Text
continuationToken) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe Text
a -> ListObjectsV2Response
s {$sel:continuationToken:ListObjectsV2Response' :: Maybe Text
continuationToken = Maybe Text
a} :: ListObjectsV2Response)

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

-- | All of the keys (up to 1,000) rolled up into 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 a 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.
listObjectsV2Response_commonPrefixes :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe [CommonPrefix])
listObjectsV2Response_commonPrefixes :: (Maybe [CommonPrefix] -> f (Maybe [CommonPrefix]))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_commonPrefixes = (ListObjectsV2Response -> Maybe [CommonPrefix])
-> (ListObjectsV2Response
    -> Maybe [CommonPrefix] -> ListObjectsV2Response)
-> Lens
     ListObjectsV2Response
     ListObjectsV2Response
     (Maybe [CommonPrefix])
     (Maybe [CommonPrefix])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe [CommonPrefix]
commonPrefixes :: Maybe [CommonPrefix]
$sel:commonPrefixes:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe [CommonPrefix]
commonPrefixes} -> Maybe [CommonPrefix]
commonPrefixes) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe [CommonPrefix]
a -> ListObjectsV2Response
s {$sel:commonPrefixes:ListObjectsV2Response' :: Maybe [CommonPrefix]
commonPrefixes = Maybe [CommonPrefix]
a} :: ListObjectsV2Response) ((Maybe [CommonPrefix] -> f (Maybe [CommonPrefix]))
 -> ListObjectsV2Response -> f ListObjectsV2Response)
-> ((Maybe [CommonPrefix] -> f (Maybe [CommonPrefix]))
    -> Maybe [CommonPrefix] -> f (Maybe [CommonPrefix]))
-> (Maybe [CommonPrefix] -> f (Maybe [CommonPrefix]))
-> ListObjectsV2Response
-> f ListObjectsV2Response
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [CommonPrefix] [CommonPrefix] [CommonPrefix] [CommonPrefix]
-> Iso
     (Maybe [CommonPrefix])
     (Maybe [CommonPrefix])
     (Maybe [CommonPrefix])
     (Maybe [CommonPrefix])
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 AnIso [CommonPrefix] [CommonPrefix] [CommonPrefix] [CommonPrefix]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Encoding type used by Amazon S3 to encode object key names in the XML
-- response.
--
-- If you specify the encoding-type request parameter, Amazon S3 includes
-- this element in the response, and returns encoded key name values in the
-- following response elements:
--
-- @Delimiter, Prefix, Key,@ and @StartAfter@.
listObjectsV2Response_encodingType :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe EncodingType)
listObjectsV2Response_encodingType :: (Maybe EncodingType -> f (Maybe EncodingType))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_encodingType = (ListObjectsV2Response -> Maybe EncodingType)
-> (ListObjectsV2Response
    -> Maybe EncodingType -> ListObjectsV2Response)
-> Lens
     ListObjectsV2Response
     ListObjectsV2Response
     (Maybe EncodingType)
     (Maybe EncodingType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe EncodingType
encodingType :: Maybe EncodingType
$sel:encodingType:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe EncodingType
encodingType} -> Maybe EncodingType
encodingType) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe EncodingType
a -> ListObjectsV2Response
s {$sel:encodingType:ListObjectsV2Response' :: Maybe EncodingType
encodingType = Maybe EncodingType
a} :: ListObjectsV2Response)

-- | The bucket name.
--
-- 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 using 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 S3 on Outposts>
-- in the /Amazon S3 User Guide/.
listObjectsV2Response_name :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe BucketName)
listObjectsV2Response_name :: (Maybe BucketName -> f (Maybe BucketName))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_name = (ListObjectsV2Response -> Maybe BucketName)
-> (ListObjectsV2Response
    -> Maybe BucketName -> ListObjectsV2Response)
-> Lens
     ListObjectsV2Response
     ListObjectsV2Response
     (Maybe BucketName)
     (Maybe BucketName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe BucketName
name :: Maybe BucketName
$sel:name:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe BucketName
name} -> Maybe BucketName
name) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe BucketName
a -> ListObjectsV2Response
s {$sel:name:ListObjectsV2Response' :: Maybe BucketName
name = Maybe BucketName
a} :: ListObjectsV2Response)

-- | @NextContinuationToken@ is sent when @isTruncated@ is true, which means
-- there are more keys in the bucket that can be listed. The next list
-- requests to Amazon S3 can be continued with this
-- @NextContinuationToken@. @NextContinuationToken@ is obfuscated and is
-- not a real key
listObjectsV2Response_nextContinuationToken :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe Prelude.Text)
listObjectsV2Response_nextContinuationToken :: (Maybe Text -> f (Maybe Text))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_nextContinuationToken = (ListObjectsV2Response -> Maybe Text)
-> (ListObjectsV2Response -> Maybe Text -> ListObjectsV2Response)
-> Lens' ListObjectsV2Response (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe Text
nextContinuationToken :: Maybe Text
$sel:nextContinuationToken:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe Text
nextContinuationToken} -> Maybe Text
nextContinuationToken) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe Text
a -> ListObjectsV2Response
s {$sel:nextContinuationToken:ListObjectsV2Response' :: Maybe Text
nextContinuationToken = Maybe Text
a} :: ListObjectsV2Response)

-- | 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.
listObjectsV2Response_maxKeys :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe Prelude.Int)
listObjectsV2Response_maxKeys :: (Maybe Int -> f (Maybe Int))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_maxKeys = (ListObjectsV2Response -> Maybe Int)
-> (ListObjectsV2Response -> Maybe Int -> ListObjectsV2Response)
-> Lens
     ListObjectsV2Response ListObjectsV2Response (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe Int
maxKeys :: Maybe Int
$sel:maxKeys:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe Int
maxKeys} -> Maybe Int
maxKeys) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe Int
a -> ListObjectsV2Response
s {$sel:maxKeys:ListObjectsV2Response' :: Maybe Int
maxKeys = Maybe Int
a} :: ListObjectsV2Response)

-- | Set to false if all of the results were returned. Set to true if more
-- keys are available to return. If the number of results exceeds that
-- specified by MaxKeys, all of the results might not be returned.
listObjectsV2Response_isTruncated :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe Prelude.Bool)
listObjectsV2Response_isTruncated :: (Maybe Bool -> f (Maybe Bool))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_isTruncated = (ListObjectsV2Response -> Maybe Bool)
-> (ListObjectsV2Response -> Maybe Bool -> ListObjectsV2Response)
-> Lens' ListObjectsV2Response (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe Bool
a -> ListObjectsV2Response
s {$sel:isTruncated:ListObjectsV2Response' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListObjectsV2Response)

-- | 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.
listObjectsV2Response_delimiter :: Lens.Lens' ListObjectsV2Response (Prelude.Maybe Delimiter)
listObjectsV2Response_delimiter :: (Maybe Delimiter -> f (Maybe Delimiter))
-> ListObjectsV2Response -> f ListObjectsV2Response
listObjectsV2Response_delimiter = (ListObjectsV2Response -> Maybe Delimiter)
-> (ListObjectsV2Response
    -> Maybe Delimiter -> ListObjectsV2Response)
-> Lens
     ListObjectsV2Response
     ListObjectsV2Response
     (Maybe Delimiter)
     (Maybe Delimiter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectsV2Response' {Maybe Delimiter
delimiter :: Maybe Delimiter
$sel:delimiter:ListObjectsV2Response' :: ListObjectsV2Response -> Maybe Delimiter
delimiter} -> Maybe Delimiter
delimiter) (\s :: ListObjectsV2Response
s@ListObjectsV2Response' {} Maybe Delimiter
a -> ListObjectsV2Response
s {$sel:delimiter:ListObjectsV2Response' :: Maybe Delimiter
delimiter = Maybe Delimiter
a} :: ListObjectsV2Response)

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

instance Prelude.NFData ListObjectsV2Response