IBM COS SDK for JavaScript V2 - v1.0.0
    Preparing search index...

    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.

    You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt.

    Use a bare-bones client and the command you need to make an API call.

    import { S3Client, ListBucketsCommand } from "ibm-cos-sdk-v2"; // ES Modules import
    // const { S3Client, ListBucketsCommand } = require("ibm-cos-sdk-v2"); // CommonJS import
    // import type { S3ClientConfig } from "ibm-cos-sdk-v2";
    const config = {}; // type is S3ClientConfig
    const client = new S3Client(config);
    const input = { // ListBucketsRequest
    IBMServiceInstanceId: "STRING_VALUE",
    MaxBuckets: Number("int"),
    ContinuationToken: "STRING_VALUE",
    Prefix: "STRING_VALUE",
    BucketRegion: "STRING_VALUE",
    };
    const command = new ListBucketsCommand(input);
    const response = await client.send(command);
    // { // ListBucketsOutput
    // Buckets: [ // Buckets
    // { // Bucket
    // Name: "STRING_VALUE",
    // CreationDate: new Date("TIMESTAMP"),
    // BucketRegion: "STRING_VALUE",
    // BucketArn: "STRING_VALUE",
    // },
    // ],
    // Owner: { // Owner
    // DisplayName: "STRING_VALUE",
    // ID: "STRING_VALUE",
    // },
    // ContinuationToken: "STRING_VALUE",
    // Prefix: "STRING_VALUE",
    // };

    ListBucketsCommandInput

    S3ServiceException

    Base exception class for all service exceptions from S3 service.

    // The following example returns all the buckets owned by the sender of this request.
    const input = { /* empty */ };
    const command = new ListBucketsCommand(input);
    const response = await client.send(command);
    /* response is
    {
    Buckets: [
    {
    CreationDate: "2012-02-15T21:03:02.000Z",
    Name: "examplebucket"
    },
    {
    CreationDate: "2011-07-24T19:33:50.000Z",
    Name: "examplebucket2"
    },
    {
    CreationDate: "2010-12-17T00:56:49.000Z",
    Name: "examplebucket3"
    }
    ],
    Owner: {
    DisplayName: "own-display-name",
    ID: "examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31"
    }
    }
    */

    Hierarchy

    Index

    Constructors

    Constructors

    • Parameters

      Returns ListBucketsCommand

    • Parameters

      Returns ListBucketsCommand