1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
<?php
/**
* PHP OpenCloud library.
*
* @copyright 2014 Rackspace Hosting, Inc. See LICENSE for information.
* @license https://www.apache.org/licenses/LICENSE-2.0
* @author Glen Campbell <glen.campbell@rackspace.com>
* @author Jamie Hannaford <jamie.hannaford@rackspace.com>
*/
namespace OpenCloud\Volume;
use OpenCloud\OpenStack;
use OpenCloud\Common\Service\NovaService;
class Service extends NovaService
{
const DEFAULT_TYPE = 'volume';
const DEFAULT_NAME = 'cloudBlockStorage';
/**
* Returns a Volume object
*
* @api
* @param string $id the Volume ID
* @return Resource\Volume
*/
public function volume($id = null)
{
return new Resource\Volume($this, $id);
}
/**
* Returns a Collection of Volume objects
*
* @api
* @param boolean $details if TRUE, return all details
* @param array $filter array of filter key/value pairs
* @return \OpenCloud\Common\Collection
*/
public function volumeList($details = true, $filter = array())
{
$url = clone $this->getUrl(Resource\Volume::ResourceName());
if ($details) {
$url->addPath('detail');
}
return $this->collection('OpenCloud\Volume\Resource\Volume', $url);
}
/**
* Returns a VolumeType object
*
* @api
* @param string $id the VolumeType ID
* @return Resource\Volume
*/
public function volumeType($id = null)
{
return new Resource\VolumeType($this, $id);
}
/**
* Returns a Collection of VolumeType objects
*
* @api
* @param array $filter array of filter key/value pairs
* @return \OpenCloud\Common\Collection
*/
public function volumeTypeList($filter = array())
{
return $this->collection('\OpenCloud\Volume\Resource\VolumeType');
}
/**
* returns a Snapshot object associated with this volume
*
* @return Resource\Snapshot
*/
public function snapshot($id = null)
{
return new Resource\Snapshot($this, $id);
}
/**
* Returns a Collection of Snapshot objects
*
* @api
* @param array $filter array of filter key/value pairs
* @return \OpenCloud\Common\Collection
*/
public function snapshotList($filter = array())
{
return $this->collection('OpenCloud\Volume\Resource\Snapshot');
}
}
|