protected function StreamWrapper::getCloudFrontUrl in AmazonS3 7.2
Get a CloudFront URL for an S3 key.
Parameters
$key: The S3 object key.
int $expiry: (optional) Expiry time for the URL, as a Unix timestamp.
Return value
\Guzzle\Http\Url The CloudFront URL.
1 call to StreamWrapper::getCloudFrontUrl()
File
- src/
StreamWrapper.php, line 463 - Drupal stream wrapper implementation for Amazon S3
Class
- StreamWrapper
- @file Drupal stream wrapper implementation for Amazon S3
Namespace
Drupal\amazons3Code
protected function getCloudFrontUrl($key, $expiry = NULL) {
// Real CloudFront credentials are required to test this, so we ignore
// testing this.
// @codeCoverageIgnoreStart
$cf = $this->config
->getCloudFront();
$url = new Url('https', $this->config
->getDomain());
$url
->setPath($key);
$this
->injectCname($url);
$options = array(
'url' => (string) $url,
'expires' => $expiry,
);
$url = Url::factory($cf
->getSignedUrl($options));
return $url;
// @codeCoverageIgnoreEnd
}