Sample code for 30+ languages & platforms
DataFlex Requires Chilkat v11.6.0+

S3 Http: Paginated Bucket Listing with Filters

See more S3 - HTTP Examples

Uses Chilkat.Http with Amazon S3 general purpose buckets and Signature Version 4. These examples do not cover directory buckets/S3 Express, access-point ARNs, Outposts, or other specialized endpoints. They target the commercial AWS partition; other partitions need their documented endpoint suffix.

Load private qa_data/aws/s3.json containing nonempty string fields access_key and secret_key, plus session_token for temporary credentials. Prefer short-lived role credentials. These samples do not discover AWS profiles or refresh credentials. Set the bucket's actual region and replace sample bucket names and object keys. TLS certificate verification is explicitly enabled. Keep detailed HTTP diagnostics private because they can contain credentials or presigned URLs.

Uses explicit signed Http requests to preserve query parameters, conditional headers, and full responses. The included SigV4 block signs the exact path, sorted encoded query and headers used by this example; it is not a general-purpose HTTP signing library. Keep the clock accurate and do not change signed data after signing. Code requires Chilkat 11.6.0 or later; locally tested with 11.8.0.

Lists account buckets with max-buckets=1000 and follows ContinuationToken, including empty pages. Optional prefix and bucket-region filters are retained. When filtering a region, select that same endpoint/signing region. Detects repeated or empty tokens and bounds enumeration at 10,000 pages.

Requires s3:ListAllMyBuckets. Uses an explicit Http request because S3_ListBuckets does not expose pagination. No Owner.DisplayName dependency. Listings are not an atomic snapshot.

AWS reference

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoStringCompare
    Handle hoCredentials
    Boolean iStringMatch1
    Boolean iStringMatch2
    Handle hoHttp
    Boolean iStringMatch3
    String sRegion
    Handle hoEndpoint
    Variant vResponse
    Handle hoResponse
    Handle hoSigner
    Handle hoNow
    Handle hoTimestamp
    Handle hoCanonical
    Handle hoCanonicalHeaders
    Handle hoSignedHeaders
    Handle hoScope
    Handle hoStringToSign
    Handle hoSigningKey
    Handle hoAuthorization
    Handle hoUrl
    Handle hoQuery
    Handle hoNumber
    Handle hoHost
    Handle hoUri
    Handle hoXml
    String sAmzDate
    String sDateStamp
    String sPayloadHash
    String sCanonicalHash
    String sDerivedKey
    String sSignature
    Integer iReplaceCount
    String sBucketRegionFilter
    String sPrefixFilter
    Boolean iStringMatch4
    Boolean iStringMatch5
    Handle hoSeen
    Boolean iMore
    Integer iPage
    String sMarker
    String sItem
    Boolean iStringMatch6
    Boolean iStringMatch7
    Boolean iStringMatch8
    Boolean iStringMatch9
    Integer i
    Boolean iStringMatch10
    Boolean iStringMatch11
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatStringBuilder)) To hoStringCompare
    If (Not(IsComObjectCreated(hoStringCompare))) Begin
        Send CreateComObject of hoStringCompare
    End
    //  This example requires the Chilkat API to have been previously unlocked.
    //  See Global Unlock Sample for sample code.
    //  Load private credentials; never put access keys or session tokens in source.
    Get Create (RefClass(cComChilkatJsonObject)) To hoCredentials
    If (Not(IsComObjectCreated(hoCredentials))) Begin
        Send CreateComObject of hoCredentials
    End
    Set ComStrict Of hoCredentials To True
    Get ComLoadFile Of hoCredentials "qa_data/aws/s3.json" To iSuccess
    If (iSuccess <> True) Begin
        Showln "Could not load private S3 credentials."
        Procedure_Return
    End

    Get ComStringOf Of hoCredentials "access_key" To sTemp1
    Get ComSetString Of hoStringCompare sTemp1 To iSuccess
    Get ComContentsEqual Of hoStringCompare "" True To iStringMatch1
    Get ComJsonTypeOf Of hoCredentials "access_key" To iTemp1
    If ((iTemp1 <> 1) Or (iStringMatch1 = True)) Begin
        Showln "Missing or invalid access_key."
        Procedure_Return
    End

    Get ComStringOf Of hoCredentials "secret_key" To sTemp1
    Get ComSetString Of hoStringCompare sTemp1 To iSuccess
    Get ComContentsEqual Of hoStringCompare "" True To iStringMatch2
    Get ComJsonTypeOf Of hoCredentials "secret_key" To iTemp1
    If ((iTemp1 <> 1) Or (iStringMatch2 = True)) Begin
        Showln "Missing or invalid secret_key."
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End
    Get ComStringOf Of hoCredentials "access_key" To sTemp1
    Set ComAwsAccessKey Of hoHttp To sTemp1
    Get ComStringOf Of hoCredentials "secret_key" To sTemp1
    Set ComAwsSecretKey Of hoHttp To sTemp1
    Get ComHasMember Of hoCredentials "session_token" To bTemp1
    If (bTemp1 = True) Begin
        Get ComStringOf Of hoCredentials "session_token" To sTemp1
        Get ComSetString Of hoStringCompare sTemp1 To iSuccess
        Get ComContentsEqual Of hoStringCompare "" True To iStringMatch3
        Get ComJsonTypeOf Of hoCredentials "session_token" To iTemp1
        If ((iTemp1 <> 1) Or (iStringMatch3 = True)) Begin
            Showln "session_token must be a nonempty string when supplied."
            Procedure_Return
        End

        Get ComStringOf Of hoCredentials "session_token" To sTemp1
        Set ComAwsSessionToken Of hoHttp To sTemp1
    End

    //  Current Chilkat uses SigV4 by default. Do not select deprecated SigV2.
    //  Set the actual bucket region, not the caller's location.
    Move "us-west-2" To sRegion
    Set ComAwsRegion Of hoHttp To sRegion
    Get Create (RefClass(cComChilkatStringBuilder)) To hoEndpoint
    If (Not(IsComObjectCreated(hoEndpoint))) Begin
        Send CreateComObject of hoEndpoint
    End
    Get ComAppend Of hoEndpoint "s3." To iSuccess
    Get ComAppend Of hoEndpoint sRegion To iSuccess
    Get ComAppend Of hoEndpoint ".amazonaws.com" To iSuccess
    Get ComGetAsString Of hoEndpoint To sTemp1
    Set ComAwsEndpoint Of hoHttp To sTemp1
    Set ComRequireSslCertVerify Of hoHttp To True
    Set ComFollowRedirects Of hoHttp To False
    //  A region redirect is not success. Correct the endpoint and signing region.
    Get Create (RefClass(cComChilkatHttpResponse)) To hoResponse
    If (Not(IsComObjectCreated(hoResponse))) Begin
        Send CreateComObject of hoResponse
    End
    Get Create (RefClass(cComChilkatCrypt2)) To hoSigner
    If (Not(IsComObjectCreated(hoSigner))) Begin
        Send CreateComObject of hoSigner
    End
    Set ComCharset Of hoSigner To "utf-8"
    Set ComHashAlgorithm Of hoSigner To "sha256"
    Set ComEncodingMode Of hoSigner To "hexlower"
    Set ComMacAlgorithm Of hoSigner To "hmac"
    Get Create (RefClass(cComCkDateTime)) To hoNow
    If (Not(IsComObjectCreated(hoNow))) Begin
        Send CreateComObject of hoNow
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoTimestamp
    If (Not(IsComObjectCreated(hoTimestamp))) Begin
        Send CreateComObject of hoTimestamp
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoCanonical
    If (Not(IsComObjectCreated(hoCanonical))) Begin
        Send CreateComObject of hoCanonical
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoCanonicalHeaders
    If (Not(IsComObjectCreated(hoCanonicalHeaders))) Begin
        Send CreateComObject of hoCanonicalHeaders
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSignedHeaders
    If (Not(IsComObjectCreated(hoSignedHeaders))) Begin
        Send CreateComObject of hoSignedHeaders
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoScope
    If (Not(IsComObjectCreated(hoScope))) Begin
        Send CreateComObject of hoScope
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoStringToSign
    If (Not(IsComObjectCreated(hoStringToSign))) Begin
        Send CreateComObject of hoStringToSign
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSigningKey
    If (Not(IsComObjectCreated(hoSigningKey))) Begin
        Send CreateComObject of hoSigningKey
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoAuthorization
    If (Not(IsComObjectCreated(hoAuthorization))) Begin
        Send CreateComObject of hoAuthorization
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoUrl
    If (Not(IsComObjectCreated(hoUrl))) Begin
        Send CreateComObject of hoUrl
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoQuery
    If (Not(IsComObjectCreated(hoQuery))) Begin
        Send CreateComObject of hoQuery
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoNumber
    If (Not(IsComObjectCreated(hoNumber))) Begin
        Send CreateComObject of hoNumber
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoHost
    If (Not(IsComObjectCreated(hoHost))) Begin
        Send CreateComObject of hoHost
    End
    Get Create (RefClass(cComChilkatStringBuilder)) To hoUri
    If (Not(IsComObjectCreated(hoUri))) Begin
        Send CreateComObject of hoUri
    End
    Get Create (RefClass(cComChilkatXml)) To hoXml
    If (Not(IsComObjectCreated(hoXml))) Begin
        Send CreateComObject of hoXml
    End

    Get ComGetAsString Of hoEndpoint To sTemp1
    Get ComAppend Of hoHost sTemp1 To iSuccess
    Get ComAppend Of hoUri "/" To iSuccess
    Move "" To sBucketRegionFilter
    Move "" To sPrefixFilter
    Get ComSetString Of hoStringCompare sBucketRegionFilter To iSuccess
    Get ComContentsEqual Of hoStringCompare "" True To iStringMatch4
    Get ComSetString Of hoStringCompare sBucketRegionFilter To iSuccess
    Get ComContentsEqual Of hoStringCompare sRegion True To iStringMatch5
    If ((iStringMatch4 <> True) And (iStringMatch5 <> True)) Begin
        Showln "Use an endpoint/signing region matching the bucket-region filter."
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatHashtable)) To hoSeen
    If (Not(IsComObjectCreated(hoSeen))) Begin
        Send CreateComObject of hoSeen
    End
    Move True To iMore
    Move 0 To iPage
    Move "" To sMarker

    While (iMore = True)
        If (iPage = 10000) Begin
            Showln "Page bound reached; results are incomplete."
            Procedure_Return
        End

        Move (iPage + 1) To iPage
        Send ComClear To hoQuery
        Get ComSetString Of hoStringCompare sBucketRegionFilter To iSuccess
        Get ComContentsEqual Of hoStringCompare "" True To iStringMatch6
        If (iStringMatch6 <> True) Begin
            Get ComLength Of hoQuery To iTemp1
            If (iTemp1 > 0) Begin
                Get ComAppend Of hoQuery "&" To iSuccess
            End

            Get ComAppend Of hoQuery "bucket-region=" To iSuccess
            Get ComUrlEncode Of hoHttp sBucketRegionFilter To sTemp1
            Get ComAppend Of hoQuery sTemp1 To iSuccess
        End

        Get ComSetString Of hoStringCompare sMarker To iSuccess
        Get ComContentsEqual Of hoStringCompare "" True To iStringMatch7
        If (iStringMatch7 <> True) Begin
            Get ComLength Of hoQuery To iTemp1
            If (iTemp1 > 0) Begin
                Get ComAppend Of hoQuery "&" To iSuccess
            End

            Get ComAppend Of hoQuery "continuation-token=" To iSuccess
            Get ComUrlEncode Of hoHttp sMarker To sTemp1
            Get ComAppend Of hoQuery sTemp1 To iSuccess
        End

        Get ComLength Of hoQuery To iTemp1
        If (iTemp1 > 0) Begin
            Get ComAppend Of hoQuery "&" To iSuccess
        End

        Get ComAppend Of hoQuery "max-buckets=" To iSuccess
        Get ComUrlEncode Of hoHttp "1000" To sTemp1
        Get ComAppend Of hoQuery sTemp1 To iSuccess
        Get ComSetString Of hoStringCompare sPrefixFilter To iSuccess
        Get ComContentsEqual Of hoStringCompare "" True To iStringMatch8
        If (iStringMatch8 <> True) Begin
            Get ComLength Of hoQuery To iTemp1
            If (iTemp1 > 0) Begin
                Get ComAppend Of hoQuery "&" To iSuccess
            End

            Get ComAppend Of hoQuery "prefix=" To iSuccess
            Get ComUrlEncode Of hoHttp sPrefixFilter To sTemp1
            Get ComAppend Of hoQuery sTemp1 To iSuccess
        End

        Send ComClearHeaders To hoHttp
        Get ComSetFromCurrentSystemTime Of hoNow To iSuccess
        If (iSuccess <> True) Begin
            Showln "Could not read system time."
            Procedure_Return
        End

        Get ComGetAsTimestamp Of hoNow False To sTemp1
        Get ComSetString Of hoTimestamp sTemp1 To iSuccess
        Get ComReplace Of hoTimestamp "-" "" To iReplaceCount
        Get ComReplace Of hoTimestamp ":" "" To iReplaceCount
        Get ComGetAsString Of hoTimestamp To sAmzDate
        Get ComGetRange Of hoTimestamp 0 8 False To sDateStamp
        Get ComHashStringENC Of hoSigner "" To sPayloadHash
        Get ComLastMethodSuccess Of hoSigner To bTemp1
        If (bTemp1 <> True) Begin
            Showln "Could not hash payload."
            Procedure_Return
        End

        Send ComClear To hoCanonicalHeaders
        Send ComClear To hoSignedHeaders
        Get ComLength Of hoSignedHeaders To iTemp1
        If (iTemp1 > 0) Begin
            Get ComAppend Of hoSignedHeaders ";" To iSuccess
        End

        Get ComAppend Of hoSignedHeaders "host" To iSuccess
        Get ComAppend Of hoCanonicalHeaders "host:" To iSuccess
        Get ComGetAsString Of hoHost To sTemp1
        Get ComAppend Of hoCanonicalHeaders sTemp1 To iSuccess
        Get ComAppend Of hoCanonicalHeaders (character(10)) To iSuccess
        Get ComGetAsString Of hoHost To sTemp1
        Send ComSetRequestHeader To hoHttp "host" sTemp1
        Get ComLength Of hoSignedHeaders To iTemp1
        If (iTemp1 > 0) Begin
            Get ComAppend Of hoSignedHeaders ";" To iSuccess
        End

        Get ComAppend Of hoSignedHeaders "x-amz-content-sha256" To iSuccess
        Get ComAppend Of hoCanonicalHeaders "x-amz-content-sha256:" To iSuccess
        Get ComAppend Of hoCanonicalHeaders sPayloadHash To iSuccess
        Get ComAppend Of hoCanonicalHeaders (character(10)) To iSuccess
        Send ComSetRequestHeader To hoHttp "x-amz-content-sha256" sPayloadHash
        Get ComLength Of hoSignedHeaders To iTemp1
        If (iTemp1 > 0) Begin
            Get ComAppend Of hoSignedHeaders ";" To iSuccess
        End

        Get ComAppend Of hoSignedHeaders "x-amz-date" To iSuccess
        Get ComAppend Of hoCanonicalHeaders "x-amz-date:" To iSuccess
        Get ComAppend Of hoCanonicalHeaders sAmzDate To iSuccess
        Get ComAppend Of hoCanonicalHeaders (character(10)) To iSuccess
        Send ComSetRequestHeader To hoHttp "x-amz-date" sAmzDate
        Get ComHasMember Of hoCredentials "session_token" To bTemp1
        If (bTemp1 = True) Begin
            Get ComLength Of hoSignedHeaders To iTemp1
            If (iTemp1 > 0) Begin
                Get ComAppend Of hoSignedHeaders ";" To iSuccess
            End

            Get ComAppend Of hoSignedHeaders "x-amz-security-token" To iSuccess
            Get ComAppend Of hoCanonicalHeaders "x-amz-security-token:" To iSuccess
            Get ComStringOf Of hoCredentials "session_token" To sTemp1
            Get ComAppend Of hoCanonicalHeaders sTemp1 To iSuccess
            Get ComAppend Of hoCanonicalHeaders (character(10)) To iSuccess
            Get ComStringOf Of hoCredentials "session_token" To sTemp1
            Send ComSetRequestHeader To hoHttp "x-amz-security-token" sTemp1
        End

        Send ComClear To hoCanonical
        Get ComAppend Of hoCanonical "GET" + (character(10)) To iSuccess
        Get ComGetAsString Of hoUri To sTemp1
        Get ComAppend Of hoCanonical sTemp1 To iSuccess
        Get ComAppend Of hoCanonical (character(10)) To iSuccess
        Get ComGetAsString Of hoQuery To sTemp1
        Get ComAppend Of hoCanonical sTemp1 To iSuccess
        Get ComAppend Of hoCanonical (character(10)) To iSuccess
        Get ComGetAsString Of hoCanonicalHeaders To sTemp1
        Get ComAppend Of hoCanonical sTemp1 To iSuccess
        Get ComAppend Of hoCanonical (character(10)) To iSuccess
        Get ComGetAsString Of hoSignedHeaders To sTemp1
        Get ComAppend Of hoCanonical sTemp1 To iSuccess
        Get ComAppend Of hoCanonical (character(10)) To iSuccess
        Get ComAppend Of hoCanonical sPayloadHash To iSuccess
        Get ComGetAsString Of hoCanonical To sTemp1
        Get ComHashStringENC Of hoSigner sTemp1 To sCanonicalHash
        Get ComLastMethodSuccess Of hoSigner To bTemp1
        If (bTemp1 <> True) Begin
            Showln "Could not hash canonical request."
            Procedure_Return
        End

        Send ComClear To hoScope
        Get ComAppend Of hoScope sDateStamp To iSuccess
        Get ComAppend Of hoScope "/" To iSuccess
        Get ComAppend Of hoScope sRegion To iSuccess
        Get ComAppend Of hoScope "/s3/aws4_request" To iSuccess
        Send ComClear To hoStringToSign
        Get ComAppend Of hoStringToSign "AWS4-HMAC-SHA256" + (character(10)) To iSuccess
        Get ComAppend Of hoStringToSign sAmzDate To iSuccess
        Get ComAppend Of hoStringToSign (character(10)) To iSuccess
        Get ComGetAsString Of hoScope To sTemp1
        Get ComAppend Of hoStringToSign sTemp1 To iSuccess
        Get ComAppend Of hoStringToSign (character(10)) To iSuccess
        Get ComAppend Of hoStringToSign sCanonicalHash To iSuccess
        Get ComSetString Of hoSigningKey "AWS4" To iSuccess
        Get ComStringOf Of hoCredentials "secret_key" To sTemp1
        Get ComAppend Of hoSigningKey sTemp1 To iSuccess
        Get ComGetAsString Of hoSigningKey To sTemp1
        Get ComSetMacKeyString Of hoSigner sTemp1 To iSuccess
        If (iSuccess <> True) Begin
            Showln "Could not set signing key."
            Procedure_Return
        End

        Get ComMacStringENC Of hoSigner sDateStamp To sDerivedKey
        Get ComLastMethodSuccess Of hoSigner To bTemp1
        If (bTemp1 <> True) Begin
            Showln "Could not derive signing key."
            Procedure_Return
        End

        Get ComSetMacKeyEncoded Of hoSigner sDerivedKey "hex" To iSuccess
        If (iSuccess <> True) Begin
            Showln "Could not set signing key."
            Procedure_Return
        End

        Get ComMacStringENC Of hoSigner sRegion To sDerivedKey
        Get ComLastMethodSuccess Of hoSigner To bTemp1
        If (bTemp1 <> True) Begin
            Showln "Could not derive signing key."
            Procedure_Return
        End

        Get ComSetMacKeyEncoded Of hoSigner sDerivedKey "hex" To iSuccess
        If (iSuccess <> True) Begin
            Showln "Could not set signing key."
            Procedure_Return
        End

        Get ComMacStringENC Of hoSigner "s3" To sDerivedKey
        Get ComLastMethodSuccess Of hoSigner To bTemp1
        If (bTemp1 <> True) Begin
            Showln "Could not derive signing key."
            Procedure_Return
        End

        Get ComSetMacKeyEncoded Of hoSigner sDerivedKey "hex" To iSuccess
        If (iSuccess <> True) Begin
            Showln "Could not set signing key."
            Procedure_Return
        End

        Get ComMacStringENC Of hoSigner "aws4_request" To sDerivedKey
        Get ComLastMethodSuccess Of hoSigner To bTemp1
        If (bTemp1 <> True) Begin
            Showln "Could not derive signing key."
            Procedure_Return
        End

        Get ComSetMacKeyEncoded Of hoSigner sDerivedKey "hex" To iSuccess
        If (iSuccess <> True) Begin
            Showln "Could not set signing key."
            Procedure_Return
        End

        Get ComGetAsString Of hoStringToSign To sTemp1
        Get ComMacStringENC Of hoSigner sTemp1 To sSignature
        Get ComLastMethodSuccess Of hoSigner To bTemp1
        If (bTemp1 <> True) Begin
            Showln "Could not sign request."
            Procedure_Return
        End

        Send ComClear To hoAuthorization
        Get ComAppend Of hoAuthorization "AWS4-HMAC-SHA256 Credential=" To iSuccess
        Get ComStringOf Of hoCredentials "access_key" To sTemp1
        Get ComAppend Of hoAuthorization sTemp1 To iSuccess
        Get ComAppend Of hoAuthorization "/" To iSuccess
        Get ComGetAsString Of hoScope To sTemp1
        Get ComAppend Of hoAuthorization sTemp1 To iSuccess
        Get ComAppend Of hoAuthorization ", SignedHeaders=" To iSuccess
        Get ComGetAsString Of hoSignedHeaders To sTemp1
        Get ComAppend Of hoAuthorization sTemp1 To iSuccess
        Get ComAppend Of hoAuthorization ", Signature=" To iSuccess
        Get ComAppend Of hoAuthorization sSignature To iSuccess
        Get ComGetAsString Of hoAuthorization To sTemp1
        Send ComSetRequestHeader To hoHttp "Authorization" sTemp1
        Get ComSetString Of hoUrl "https://" To iSuccess
        Get ComGetAsString Of hoHost To sTemp1
        Get ComAppend Of hoUrl sTemp1 To iSuccess
        Get ComGetAsString Of hoUri To sTemp1
        Get ComAppend Of hoUrl sTemp1 To iSuccess
        Get ComLength Of hoQuery To iTemp1
        If (iTemp1 > 0) Begin
            Get ComAppend Of hoUrl "?" To iSuccess
            Get ComGetAsString Of hoQuery To sTemp1
            Get ComAppend Of hoUrl sTemp1 To iSuccess
        End

        Get ComGetAsString Of hoUrl To sTemp1
        Get pvComObject of hoResponse to vResponse
        Get ComHttpNoBody Of hoHttp "GET" sTemp1 vResponse To iSuccess
        Get ComStatusCode Of hoResponse To iTemp1
        If ((iSuccess <> True) Or (iTemp1 <> 200)) Begin
            Get ComStatusCode Of hoResponse To iTemp1
            Showln "Request failed or returned unexpected HTTP status: " iTemp1
            //  Preserve progress. Inspect full diagnostics privately; do not log secrets.
            Procedure_Return
        End

        Get ComBodyStr Of hoResponse To sTemp1
        Get ComLoadXml Of hoXml sTemp1 To iSuccess
        If (iSuccess <> True) Begin
            Showln "Invalid XML response."
            Procedure_Return
        End

        Get ComTag Of hoXml To sTemp1
        Get ComSetString Of hoStringCompare sTemp1 To iSuccess
        Get ComContentsEqual Of hoStringCompare "ListAllMyBucketsResult" True To iStringMatch9
        If (iStringMatch9 <> True) Begin
            Showln "Unexpected XML result, possibly an embedded S3 error. Inspect privately."
            Procedure_Return
        End

        Get ComHasChildWithTag Of hoXml "Buckets" To bTemp1
        If (bTemp1 <> True) Begin
            Showln "Missing Buckets container."
            Procedure_Return
        End

        Move 0 To i
        While (i < (ComNumChildrenAt(hoXml, "Buckets")))
            Set ComI Of hoXml To i
            Get ComGetChildContent Of hoXml "Buckets|Bucket[i]|Name" To sItem
            Get ComSetString Of hoStringCompare sItem To iSuccess
            Get ComContentsEqual Of hoStringCompare "" True To iStringMatch10
            Get ComLastMethodSuccess Of hoXml To bTemp1
            If ((bTemp1 <> True) Or (iStringMatch10 = True)) Begin
                Showln "Missing required Buckets|Bucket[i]|Name."
                Procedure_Return
            End

            Showln "Bucket: " sItem
            Move (i + 1) To i
        Loop

        Move False To iMore
        Get ComHasChildWithTag Of hoXml "ContinuationToken" To bTemp1
        If (bTemp1 = True) Begin
            Get ComGetChildContent Of hoXml "ContinuationToken" To sMarker
            Get ComSetString Of hoStringCompare sMarker To iSuccess
            Get ComContentsEqual Of hoStringCompare "" True To iStringMatch11
            Get ComLastMethodSuccess Of hoXml To bTemp1
            If ((bTemp1 <> True) Or (iStringMatch11 = True)) Begin
                Showln "Missing required ContinuationToken."
                Procedure_Return
            End

            Get ComContains Of hoSeen sMarker To bTemp1
            If (bTemp1 = True) Begin
                Showln "Repeated pagination marker; results are incomplete."
                Procedure_Return
            End

            Get ComAddStr Of hoSeen sMarker "seen" To iSuccess
            If (iSuccess <> True) Begin
                Showln "Could not track marker."
                Procedure_Return
            End

            Move True To iMore
        End

    Loop

    Showln "Paginated bucket listing complete."


End_Procedure