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) |
Safe Haskell | None |
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_startAfter :: Lens' ListObjectsV2 (Maybe Text)
- listObjectsV2_continuationToken :: Lens' ListObjectsV2 (Maybe Text)
- listObjectsV2_fetchOwner :: Lens' ListObjectsV2 (Maybe Bool)
- listObjectsV2_prefix :: Lens' ListObjectsV2 (Maybe Text)
- listObjectsV2_encodingType :: Lens' ListObjectsV2 (Maybe EncodingType)
- listObjectsV2_requestPayer :: Lens' ListObjectsV2 (Maybe RequestPayer)
- listObjectsV2_maxKeys :: Lens' ListObjectsV2 (Maybe Int)
- listObjectsV2_delimiter :: Lens' ListObjectsV2 (Maybe Delimiter)
- listObjectsV2_expectedBucketOwner :: Lens' ListObjectsV2 (Maybe Text)
- listObjectsV2_bucket :: Lens' ListObjectsV2 BucketName
- data ListObjectsV2Response = ListObjectsV2Response' {
- startAfter :: Maybe Text
- keyCount :: Maybe Int
- contents :: Maybe [Object]
- continuationToken :: Maybe Text
- prefix :: Maybe Text
- commonPrefixes :: Maybe [CommonPrefix]
- encodingType :: Maybe EncodingType
- name :: Maybe BucketName
- nextContinuationToken :: Maybe Text
- maxKeys :: Maybe Int
- isTruncated :: Maybe Bool
- delimiter :: Maybe Delimiter
- httpStatus :: Int
- newListObjectsV2Response :: Int -> ListObjectsV2Response
- listObjectsV2Response_startAfter :: Lens' ListObjectsV2Response (Maybe Text)
- listObjectsV2Response_keyCount :: Lens' ListObjectsV2Response (Maybe Int)
- listObjectsV2Response_contents :: Lens' ListObjectsV2Response (Maybe [Object])
- listObjectsV2Response_continuationToken :: Lens' ListObjectsV2Response (Maybe Text)
- listObjectsV2Response_prefix :: Lens' ListObjectsV2Response (Maybe Text)
- listObjectsV2Response_commonPrefixes :: Lens' ListObjectsV2Response (Maybe [CommonPrefix])
- listObjectsV2Response_encodingType :: Lens' ListObjectsV2Response (Maybe EncodingType)
- listObjectsV2Response_name :: Lens' ListObjectsV2Response (Maybe BucketName)
- listObjectsV2Response_nextContinuationToken :: Lens' ListObjectsV2Response (Maybe Text)
- listObjectsV2Response_maxKeys :: Lens' ListObjectsV2Response (Maybe Int)
- listObjectsV2Response_isTruncated :: Lens' ListObjectsV2Response (Maybe Bool)
- listObjectsV2Response_delimiter :: Lens' ListObjectsV2Response (Maybe Delimiter)
- listObjectsV2Response_httpStatus :: Lens' ListObjectsV2Response Int
Creating a Request
data ListObjectsV2 Source #
See: newListObjectsV2
smart constructor.
ListObjectsV2' | |
|
Instances
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:
$sel:startAfter: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.
$sel:continuationToken: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.
$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.
$sel:prefix:ListObjectsV2'
, listObjectsV2_prefix
- Limits the response to keys that begin with the specified prefix.
$sel:encodingType:ListObjectsV2'
, listObjectsV2_encodingType
- Encoding type used by Amazon S3 to encode object keys in the response.
$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.
$sel:maxKeys: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.
$sel:delimiter:ListObjectsV2'
, listObjectsV2_delimiter
- A delimiter is a character you use to group keys.
$sel:expectedBucketOwner:ListObjectsV2'
, 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.
$sel: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 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 Using S3 on Outposts in the Amazon S3 User Guide.
Request Lenses
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_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_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_prefix :: Lens' ListObjectsV2 (Maybe Text) Source #
Limits the response to keys that begin with the specified prefix.
listObjectsV2_encodingType :: Lens' ListObjectsV2 (Maybe EncodingType) Source #
Encoding type used by Amazon S3 to encode object keys in the response.
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_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_delimiter :: Lens' ListObjectsV2 (Maybe Delimiter) Source #
A delimiter is a character you use to group keys.
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 will fail with an HTTP
403 (Access Denied)
error.
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 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 Using S3 on Outposts in the Amazon S3 User Guide.
Destructuring the Response
data ListObjectsV2Response Source #
See: newListObjectsV2Response
smart constructor.
ListObjectsV2Response' | |
|
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:startAfter:ListObjectsV2'
, listObjectsV2Response_startAfter
- If StartAfter was sent with the request, it is included in the response.
$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
$sel:contents:ListObjectsV2Response'
, listObjectsV2Response_contents
- Metadata about each object returned.
$sel:continuationToken:ListObjectsV2'
, listObjectsV2Response_continuationToken
- If ContinuationToken was sent with the request, it is included in the
response.
$sel:prefix:ListObjectsV2'
, listObjectsV2Response_prefix
- Keys that begin with the indicated prefix.
$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:encodingType: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
.
$sel:name: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 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 Using 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
$sel:maxKeys: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.
$sel:isTruncated: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:delimiter: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.
$sel:httpStatus:ListObjectsV2Response'
, listObjectsV2Response_httpStatus
- The response's http status code.
Response Lenses
listObjectsV2Response_startAfter :: Lens' ListObjectsV2Response (Maybe Text) Source #
If StartAfter was sent with the request, it is included in the response.
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_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_prefix :: Lens' ListObjectsV2Response (Maybe Text) Source #
Keys that begin with the indicated prefix.
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_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_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 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 Using 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_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_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_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_httpStatus :: Lens' ListObjectsV2Response Int Source #
The response's http status code.