Amazon_S3_And_CloudFront::get_bucket_region PHP Method

get_bucket_region() public method

Get the region of a bucket
public get_bucket_region ( string $bucket ) : string | WP_Error
$bucket string
return string | WP_Error
    function get_bucket_region($bucket)
    {
        try {
            $region = $this->get_s3client()->getBucketLocation(array('Bucket' => $bucket));
        } catch (Exception $e) {
            $error_msg_title = '<strong>' . __('Error Getting Bucket Region', 'amazon-s3-and-cloudfront') . '</strong> &mdash;';
            $error_msg = sprintf(__('There was an error attempting to get the region of the bucket %s: %s', 'amazon-s3-and-cloudfront'), $bucket, $e->getMessage());
            AS3CF_Error::log($error_msg);
            return new WP_Error('exception', $error_msg_title . $error_msg);
        }
        $region = $this->translate_region($region['Location']);
        return $region;
    }
Amazon_S3_And_CloudFront