/AWS1/CL_S3=>LISTBUCKETS()
¶
About ListBuckets¶
End of support notice: Beginning October 1, 2025, Amazon S3 will stop returning DisplayName
. Update your applications to use canonical IDs (unique identifier for
Amazon Web Services accounts), Amazon Web Services account ID (12 digit identifier) or IAM ARNs (full resource naming) as a direct replacement of DisplayName
.
This change affects the following Amazon Web Services Regions: US East (N. Virginia) Region, US West (N. California) Region, US West (Oregon) Region, Asia Pacific (Singapore) Region, Asia Pacific (Sydney) Region, Asia Pacific (Tokyo) Region, Europe (Ireland) Region, and South America (São Paulo) Region.
This operation is not supported for directory buckets.
Returns a list of all buckets owned by the authenticated sender of the request. To grant IAM
permission to use this operation, you must add the s3:ListAllMyBuckets
policy action.
For information about Amazon S3 buckets, see Creating, configuring, and working with Amazon S3 buckets.
We strongly recommend using only paginated ListBuckets
requests. Unpaginated
ListBuckets
requests are only supported for Amazon Web Services accounts set to the default general
purpose bucket quota of 10,000. If you have an approved general purpose bucket quota above 10,000, you
must send paginated ListBuckets
requests to list your account’s buckets. All unpaginated
ListBuckets
requests will be rejected for Amazon Web Services accounts with a general purpose bucket
quota greater than 10,000.
Method Signature¶
IMPORTING¶
Optional arguments:¶
iv_maxbuckets
TYPE /AWS1/S3_MAXBUCKETS
/AWS1/S3_MAXBUCKETS
¶
Maximum number of buckets to be returned in response. When the number is more than the count of buckets that are owned by an Amazon Web Services account, return all the buckets in response.
iv_continuationtoken
TYPE /AWS1/S3_TOKEN
/AWS1/S3_TOKEN
¶
ContinuationToken
indicates to Amazon S3 that the list is being continued on this bucket with a token.ContinuationToken
is obfuscated and is not a real key. You can use thisContinuationToken
for pagination of the list results.Length Constraints: Minimum length of 0. Maximum length of 1024.
Required: No.
If you specify the
bucket-region
,prefix
, orcontinuation-token
query parameters without usingmax-buckets
to set the maximum number of buckets returned in the response, Amazon S3 applies a default page size of 10,000 and provides a continuation token if there are more buckets.
iv_prefix
TYPE /AWS1/S3_PREFIX
/AWS1/S3_PREFIX
¶
Limits the response to bucket names that begin with the specified bucket name prefix.
iv_bucketregion
TYPE /AWS1/S3_BUCKETREGION
/AWS1/S3_BUCKETREGION
¶
Limits the response to buckets that are located in the specified Amazon Web Services Region. The Amazon Web Services Region must be expressed according to the Amazon Web Services Region code, such as
us-west-2
for the US West (Oregon) Region. For a list of the valid values for all of the Amazon Web Services Regions, see Regions and Endpoints.Requests made to a Regional endpoint that is different from the
bucket-region
parameter are not supported. For example, if you want to limit the response to your buckets in Regionus-west-2
, the request must be made to an endpoint in Regionus-west-2
.
RETURNING¶
oo_output
TYPE REF TO /aws1/cl_s3_listbucketsoutput
/AWS1/CL_S3_LISTBUCKETSOUTPUT
¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->/aws1/if_s3~listbuckets(
iv_bucketregion = |string|
iv_continuationtoken = |string|
iv_maxbuckets = 123
iv_prefix = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
LOOP AT lo_result->get_buckets( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_bucketname = lo_row_1->get_name( ).
lv_creationdate = lo_row_1->get_creationdate( ).
lv_bucketregion = lo_row_1->get_bucketregion( ).
lv_s3regionalors3expressbu = lo_row_1->get_bucketarn( ).
ENDIF.
ENDLOOP.
lo_owner = lo_result->get_owner( ).
IF lo_owner IS NOT INITIAL.
lv_displayname = lo_owner->get_displayname( ).
lv_id = lo_owner->get_id( ).
ENDIF.
lv_nexttoken = lo_result->get_continuationtoken( ).
lv_prefix = lo_result->get_prefix( ).
ENDIF.
To list all buckets¶
The following example returns all the buckets owned by the sender of this request.
DATA(lo_result) = lo_client->/aws1/if_s3~listbuckets( ).