public static function S3Client::validateBucketExists in AmazonS3 7.2
Validate that a bucket exists.
Since bucket names are global across all of S3, we can't determine if a bucket doesn't exist at all, or if it exists but is owned by another S3 account.
Parameters
string $bucket: The name of the bucket to test.
\Aws\S3\S3Client $client: The S3Client to use.
Throws
S3ConnectValidationException Thrown when credentials are invalid or the bucket does not exist.
4 calls to S3Client::validateBucketExists()
- amazons3_file_entity_upload_destination_uri_alter in ./
amazons3.module - Implements hook_file_entity_upload_destination_uri_alter().
- amazons3_file_stream_wrapper_uri_normalize_alter in ./
amazons3.module - Implements hook_file_stream_wrapper_uri_normalize_alter().
- amazons3_form_bucket_validate in ./
amazons3.module - Element validate callback to validate a bucket name.
- amazons3_requirements in ./
amazons3.install - Implements hook_requirements().
File
- src/
S3Client.php, line 125 - A wrapper around S3Client::factory() using aws_key / aws_secret variables.
Class
- S3Client
- A wrapper around S3Client::factory() using aws_key / aws_secret variables.
Namespace
Drupal\amazons3Code
public static function validateBucketExists($bucket, AwsS3Client $client) {
if (!$client
->doesBucketExist($bucket, FALSE)) {
throw new S3ConnectValidationException('The S3 access credentials are invalid or the bucket does not exist.');
}
}