Copyright | (c) 2013-2023 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Amazonka.S3.ListObjectsV2
Description
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
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
Permissions Related to Bucket Subresource Operations
and
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, ListObjects.
To get a list of your buckets, see ListBuckets.
The following operations are related to ListObjectsV2
:
This operation returns paginated results.
Synopsis
- data ListObjectsV2 = ListObjectsV2' {}
- newListObjectsV2 :: BucketName -> ListObjectsV2
- listObjectsV2_continuationToken :: Lens' ListObjectsV2 (Maybe Text)
- listObjectsV2_delimiter :: Lens' ListObjectsV2 (Maybe Delimiter)
- listObjectsV2_encodingType :: Lens' ListObjectsV2 (Maybe EncodingType)
- listObjectsV2_expectedBucketOwner :: Lens' ListObjectsV2 (Maybe Text)
- listObjectsV2_fetchOwner :: Lens' ListObjectsV2 (Maybe Bool)
- listObjectsV2_maxKeys :: Lens' ListObjectsV2 (Maybe Int)
- listObjectsV2_prefix :: Lens' ListObjectsV2 (Maybe Text)
- listObjectsV2_requestPayer :: Lens' ListObjectsV2 (Maybe RequestPayer)
- listObjectsV2_startAfter :: Lens' ListObjectsV2 (Maybe Text)
- listObjectsV2_bucket :: Lens' ListObjectsV2 BucketName
- data ListObjectsV2Response = ListObjectsV2Response' {
- commonPrefixes :: Maybe [CommonPrefix]
- contents :: Maybe [Object]
- continuationToken :: Maybe Text
- delimiter :: Maybe Delimiter
- encodingType :: Maybe EncodingType
- isTruncated :: Maybe Bool
- keyCount :: Maybe Int
- maxKeys :: Maybe Int
- name :: Maybe BucketName
- nextContinuationToken :: Maybe Text
- prefix :: Maybe Text
- startAfter :: Maybe Text
- httpStatus :: Int
- newListObjectsV2Response :: Int -> ListObjectsV2Response
- listObjectsV2Response_commonPrefixes :: Lens' ListObjectsV2Response (Maybe [CommonPrefix])
- listObjectsV2Response_contents :: Lens' ListObjectsV2Response (Maybe [Object])
- listObjectsV2Response_continuationToken :: Lens' ListObjectsV2Response (Maybe Text)
- listObjectsV2Response_delimiter :: Lens' ListObjectsV2Response (Maybe Delimiter)
- listObjectsV2Response_encodingType :: Lens' ListObjectsV2Response (Maybe EncodingType)
- listObjectsV2Response_isTruncated :: Lens' ListObjectsV2Response (Maybe Bool)
- listObjectsV2Response_keyCount :: Lens' ListObjectsV2Response (Maybe Int)
- listObjectsV2Response_maxKeys :: Lens' ListObjectsV2Response (Maybe Int)
- listObjectsV2Response_name :: Lens' ListObjectsV2Response (Maybe BucketName)
- listObjectsV2Response_nextContinuationToken :: Lens' ListObjectsV2Response (Maybe Text)
- listObjectsV2Response_prefix :: Lens' ListObjectsV2Response (Maybe Text)
- listObjectsV2Response_startAfter :: Lens' ListObjectsV2Response (Maybe Text)
- listObjectsV2Response_httpStatus :: Lens' ListObjectsV2Response Int
Creating a Request
data ListObjectsV2 Source #
See: newListObjectsV2
smart constructor.
Constructors
ListObjectsV2' | |
Fields
|
Instances
Arguments
:: BucketName | |
-> ListObjectsV2 |
Create a value of ListObjectsV2
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
ListObjectsV2
, 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.
ListObjectsV2
, listObjectsV2_delimiter
- A delimiter is a character you use to group keys.
ListObjectsV2
, listObjectsV2_encodingType
- Encoding type used by Amazon S3 to encode object keys in the response.
$sel:expectedBucketOwner:ListObjectsV2'
, listObjectsV2_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).
$sel:fetchOwner:ListObjectsV2'
, 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.
ListObjectsV2
, 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.
ListObjectsV2
, listObjectsV2_prefix
- Limits the response to keys that begin with the specified prefix.
$sel:requestPayer:ListObjectsV2'
, 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.
ListObjectsV2
, 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.
ListObjectsV2
, 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 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
Using Amazon S3 on Outposts
in the Amazon S3 User Guide.
Request Lenses
listObjectsV2_continuationToken :: Lens' ListObjectsV2 (Maybe Text) Source #
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_delimiter :: Lens' ListObjectsV2 (Maybe Delimiter) Source #
A delimiter is a character you use to group keys.
listObjectsV2_encodingType :: Lens' ListObjectsV2 (Maybe EncodingType) Source #
Encoding type used by Amazon S3 to encode object keys in the response.
listObjectsV2_expectedBucketOwner :: Lens' ListObjectsV2 (Maybe Text) Source #
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).
listObjectsV2_fetchOwner :: Lens' ListObjectsV2 (Maybe Bool) Source #
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_maxKeys :: Lens' ListObjectsV2 (Maybe Int) Source #
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_prefix :: Lens' ListObjectsV2 (Maybe Text) Source #
Limits the response to keys that begin with the specified prefix.
listObjectsV2_requestPayer :: Lens' ListObjectsV2 (Maybe RequestPayer) Source #
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_startAfter :: Lens' ListObjectsV2 (Maybe Text) Source #
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_bucket :: Lens' ListObjectsV2 BucketName Source #
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 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
Using Amazon S3 on Outposts
in the Amazon S3 User Guide.
Destructuring the Response
data ListObjectsV2Response Source #
See: newListObjectsV2Response
smart constructor.
Constructors
ListObjectsV2Response' | |
Fields
|
Instances
newListObjectsV2Response Source #
Create a value of ListObjectsV2Response
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:commonPrefixes:ListObjectsV2Response'
, 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.
$sel:contents:ListObjectsV2Response'
, listObjectsV2Response_contents
- Metadata about each object returned.
ListObjectsV2
, listObjectsV2Response_continuationToken
- If ContinuationToken was sent with the request, it is included in the
response.
ListObjectsV2
, 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.
ListObjectsV2
, 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
.
ListObjectsV2Response
, 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.
$sel:keyCount:ListObjectsV2Response'
, 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
ListObjectsV2
, 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.
ListObjectsV2Response
, 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 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
Using Amazon S3 on Outposts
in the Amazon S3 User Guide.
$sel:nextContinuationToken:ListObjectsV2Response'
, 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
ListObjectsV2
, listObjectsV2Response_prefix
- Keys that begin with the indicated prefix.
ListObjectsV2
, listObjectsV2Response_startAfter
- If StartAfter was sent with the request, it is included in the response.
$sel:httpStatus:ListObjectsV2Response'
, listObjectsV2Response_httpStatus
- The response's http status code.
Response Lenses
listObjectsV2Response_commonPrefixes :: Lens' ListObjectsV2Response (Maybe [CommonPrefix]) Source #
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_contents :: Lens' ListObjectsV2Response (Maybe [Object]) Source #
Metadata about each object returned.
listObjectsV2Response_continuationToken :: Lens' ListObjectsV2Response (Maybe Text) Source #
If ContinuationToken was sent with the request, it is included in the response.
listObjectsV2Response_delimiter :: Lens' ListObjectsV2Response (Maybe Delimiter) Source #
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_encodingType :: Lens' ListObjectsV2Response (Maybe EncodingType) Source #
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_isTruncated :: Lens' ListObjectsV2Response (Maybe Bool) Source #
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_keyCount :: Lens' ListObjectsV2Response (Maybe Int) Source #
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_maxKeys :: Lens' ListObjectsV2Response (Maybe Int) Source #
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_name :: Lens' ListObjectsV2Response (Maybe BucketName) Source #
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 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
Using Amazon S3 on Outposts
in the Amazon S3 User Guide.
listObjectsV2Response_nextContinuationToken :: Lens' ListObjectsV2Response (Maybe Text) Source #
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_prefix :: Lens' ListObjectsV2Response (Maybe Text) Source #
Keys that begin with the indicated prefix.
listObjectsV2Response_startAfter :: Lens' ListObjectsV2Response (Maybe Text) Source #
If StartAfter was sent with the request, it is included in the response.
listObjectsV2Response_httpStatus :: Lens' ListObjectsV2Response Int Source #
The response's http status code.