s3listobjects
s3listobjects |
Purpose
Synopsis
procedure s3listobjects(bucket:s3bucket, prefix:text, delimiter:text, result:s3objectlist)
procedure s3listobjects(bucket:s3bucket, prefix:text, result:s3objectlist)
Arguments
bucket
|
The s3bucket object describing the bucket to access
|
prefix
|
The object prefix to search for
|
delimiter
|
The object delimiter, or "" for no delimiter. If a delimiter is specified, then any objects containing this string after the prefix will not be returned in result.objects, but each unique string between the prefix and the next occurrence of this delimiter will be returned in result.commonprefixes
|
result
|
Record structure to retrieve
|
Example
declarations myresult: s3objectlist end-declarations repeat s3listobjects( mybucket, "myprefix/", myresult ) if s3status(mybucket)<>S3_OK then writeln("Error returned by S3: ",s3getlasterror(mybucket)) exit(1) end-if forall (o in myresult.objects) do writeln('Found object with key ',o.key) end-do until not myresult.istruncated
Further information
1. After calling, check the value of
s3status for any errors.
2. As the number of objects in an S3 bucket can be very large, this function may return a truncated list of the keys. If this is the case, the
istruncated flag of the
s3objectlist will be set to 'true' and you should call
s3listobjects again, passing the same record, to retrieve the next batch of object keys.
3. If the s3bucket has a configured keyprefix, it will be prepended to the prefix specified by the
s3listobjects request
4. If the s3bucket has a configured keyprefix, it will be stripped from the keys and prefixes returned in the
s3objectlist
Related topics