src/Volume.php
public static function loadBucketList($keyId, $secret)
    {
        // Any region will do.
        $config = self::_buildConfigArray($keyId, $secret, 'us-east-1');

        $client = static::client($config);

        $objects = $client->listBuckets();

        if (empty($objects['Buckets'])) {
            return [];
        }

        $buckets = $objects['Buckets'];
        $bucketList = [];

        foreach ($buckets as $bucket) {
            try {
                $region = $client->determineBucketRegion($bucket['Name']);
            } catch (S3Exception $exception) {

                // If a bucket cannot be accessed by the current policy, move along:
                // https://github.com/craftcms/aws-s3/pull/29#issuecomment-468193410
                continue;
            }

            $bucketList[] = [
                'bucket' => $bucket['Name'],
                'urlPrefix' => 'https://s3.'.$region.'.amazonaws.com/'.$bucket['Name'].'/',
                'region' => $region
            ];
        }

        return $bucketList;
    }
public static function loadBucketList($keyId, $secret)
    {
        // Any region will do.
        $config = self::_buildConfigArray($keyId, $secret, 'us-east-1');

        $client = static::client($config);

        $objects = $client->listBuckets();

        if (empty($objects['Buckets'])) {
            return [];
        }

        $buckets = $objects['Buckets'];
        $bucketList = [];

        foreach ($buckets as $bucket) {
            try {
                $region = $client->determineBucketRegion($bucket['Name']);
            } catch (S3Exception $exception) {

                // If a bucket cannot be accessed by the current policy, move along:
                // https://github.com/craftcms/aws-s3/pull/29#issuecomment-468193410
                continue;
            }

            $bucketList[] = [
                'bucket' => $bucket['Name'],
                'urlPrefix' => 'https://s3.'.$region.'.amazonaws.com/'.$bucket['Name'].'/',
                'region' => $region
            ];
        }

        return $bucketList;
    }
public static function loadBucketList ( $ keyId , $ secret ) { // Any region will do. $ config = self :: _buildConfigArray ( $ keyId , $ secret , 'us-east-1' ) ; $ client = static :: client ( $ config ) ; $ objects = $ client -> listBuckets ( ) ; if ( empty ( $ objects [ 'Buckets' ] ) ) { return [ ] ; } $ buckets = $ objects [ 'Buckets' ] ; $ bucketList = [ ] ; foreach ( $ buckets as $ bucket ) { try { $ region = $ client -> determineBucketRegion ( $ bucket [ 'Name' ] ) ; } catch ( S3Exception $ exception ) { // If a bucket cannot be accessed by the current policy, move along: // https://github.com/craftcms/aws-s3/pull/29#issuecomment-468193410 continue ; } $ bucketList [ ] = [ 'bucket' => $ bucket [ 'Name' ] , 'urlPrefix' => 'https://s3.' . $ region . '.amazonaws.com/' . $ bucket [ 'Name' ] . '/' , 'region' => $ region ] ; } return $ bucketList ; }
Get the bucket list using the specified credentials.

@param $keyId
@param $secret
@return array
@throws \InvalidArgumentException
Get the bucket list using the specified credentials .