public function listBucketsCommand()
    {
        try {
            $s3Client = new S3Client($this->s3DefaultProfile);
            $result = $s3Client->listBuckets();
        } catch (\Exception $e) {
            $this->outputLine($e->getMessage());
            $this->quit(1);
            exit;
        }

        if (count($result['Buckets']) === 0) {
            $this->outputLine('The account currently does not have any buckets.');
        }

        $tableRows = array();
        $headerRow = array('Bucket Name', 'Creation Date');

        foreach ($result['Buckets'] as $bucket) {
            $tableRows[] = array($bucket['Name'], $bucket['CreationDate']);
        }

        $this->output->outputTable($tableRows, $headerRow);
    }
public function listBucketsCommand()
    {
        try {
            $s3Client = new S3Client($this->s3DefaultProfile);
            $result = $s3Client->listBuckets();
        } catch (\Exception $e) {
            $this->outputLine($e->getMessage());
            $this->quit(1);
            exit;
        }

        if (count($result['Buckets']) === 0) {
            $this->outputLine('The account currently does not have any buckets.');
        }

        $tableRows = array();
        $headerRow = array('Bucket Name', 'Creation Date');

        foreach ($result['Buckets'] as $bucket) {
            $tableRows[] = array($bucket['Name'], $bucket['CreationDate']);
        }

        $this->output->outputTable($tableRows, $headerRow);
    }
public function listBucketsCommand ( ) { try { $ s3Client = new S3Client ( $ this -> s3DefaultProfile ) ; $ result = $ s3Client -> listBuckets ( ) ; } catch ( \ Exception $ e ) { $ this -> outputLine ( $ e -> getMessage ( ) ) ; $ this -> quit ( 1 ) ; exit ; } if ( count ( $ result [ 'Buckets' ] ) === 0 ) { $ this -> outputLine ( 'The account currently does not have any buckets.' ) ; } $ tableRows = array ( ) ; $ headerRow = array ( 'Bucket Name' , 'Creation Date' ) ; foreach ( $ result [ 'Buckets' ] as $ bucket ) { $ tableRows [ ] = array ( $ bucket [ 'Name' ] , $ bucket [ 'CreationDate' ] ) ; } $ this -> output -> outputTable ( $ tableRows , $ headerRow ) ; }
Displays a list of buckets

This command outputs a list of all buckets from the currently configured S3
account.

@return void
Displays a list of buckets