The AWS S3 adapter has a public getClient() method, allowing for access and use of the raw S3Client instance.
The Rackspace adapter doesn't have a similar accessor for the underlying OpenCloud container.
@frankdejonge described adding a Rackspace-only plugin to fetch a CDN URL for an object. This can't be done without access to the container.
Also related to #2, #3, and #6, here's a plugin providing a getUrl() method on the adapter.
<?php
namespace League\Flysystem\Rackspace\Plugin;
use Guzzle\Http\Url;
use League\Flysystem\Plugin\AbstractPlugin;
use League\Flysystem\NotSupportedException;
use OpenCloud\ObjectStore\Constants\UrlType;
class GetUrl extends AbstractPlugin
{
/**
* Get the method name.
*
* @return string
*/
public function getMethod()
{
return 'getUrl';
}
/**
* Get the Url object for a path.
*
* @param string $path path to file
* @param string $urlType OpenCloud URL type
*
* @return Url
*/
public function handle($path, $urlType = UrlType::SSL)
{
$container = $this->filesystem->getAdapter()->getContainer();
if ( ! $container->isCdnEnabled()) {
throw new NotSupportedException(
'The Rackspace container must be CDN-enabled to fetch a public URL for ' . $path
);
}
return $container->getObject($path)->getPublicUrl($urlType);
}
}
The AWS S3 adapter has a public
getClient()
method, allowing for access and use of the rawS3Client
instance.The Rackspace adapter doesn't have a similar accessor for the underlying OpenCloud container.
@frankdejonge described adding a Rackspace-only plugin to fetch a CDN URL for an object. This can't be done without access to the container.
Also related to #2, #3, and #6, here's a plugin providing a
getUrl()
method on the adapter.