/**
  * Get bucket list with credentials.
  *
  * @param $keyId
  * @param $secret
  *
  * @throws Exception
  * @return array
  */
 public static function getBucketList($keyId, $secret)
 {
     $googleCloud = new \GC($keyId, $secret);
     $buckets = @$googleCloud->listBuckets();
     if (empty($buckets)) {
         throw new Exception(Craft::t("Credentials rejected by target host."));
     }
     $bucketList = array();
     foreach ($buckets as $bucket) {
         $location = $googleCloud->getBucketLocation($bucket);
         $bucketList[] = array('bucket' => $bucket, 'location' => $location, 'url_prefix' => 'http://' . static::$_endpoint . '/' . $bucket . '/');
     }
     return $bucketList;
 }