1: <?php
2: /**
3: * The OpenStack Cinder (Volume) service
4: *
5: * @copyright 2012-2013 Rackspace Hosting, Inc.
6: * See COPYING for licensing information
7: *
8: * @package phpOpenCloud
9: * @version 1.0
10: * @author Glen Campbell <glen.campbell@rackspace.com>
11: */
12:
13: namespace OpenCloud\Volume;
14:
15: use OpenCloud\OpenStack;
16: use OpenCloud\Common\Nova;
17:
18: class Service extends Nova
19: {
20:
21: /**
22: * creates the VolumeService object
23: */
24: public function __construct(
25: OpenStack $connection,
26: $name,
27: $region,
28: $urltype
29: ) {
30: parent::__construct($connection, 'volume', $name, $region, $urltype);
31: }
32:
33: /**
34: * Returns a Volume object
35: *
36: * @api
37: * @param string $id the Volume ID
38: * @return VolumeService\Volume
39: */
40: public function Volume($id = null)
41: {
42: return new Volume($this, $id);
43: }
44:
45: /**
46: * Returns a Collection of Volume objects
47: *
48: * @api
49: * @param boolean $details if TRUE, return all details
50: * @param array $filters array of filter key/value pairs
51: * @return Collection
52: */
53: public function VolumeList($details = true, $filter = array())
54: {
55: $url = $this->Url(Volume::ResourceName()) . ($details ? '/detail' : '');
56: return $this->Collection('\OpenCloud\Volume\Volume', $url);
57: }
58:
59: /**
60: * Returns a VolumeType object
61: *
62: * @api
63: * @param string $id the VolumeType ID
64: * @return VolumeService\Volume
65: */
66: public function VolumeType($id = null)
67: {
68: return new VolumeType($this, $id);
69: }
70:
71: /**
72: * Returns a Collection of VolumeType objects
73: *
74: * @api
75: * @param array $filters array of filter key/value pairs
76: * @return Collection
77: */
78: public function VolumeTypeList($filter = array())
79: {
80: return $this->Collection('\OpenCloud\Volume\VolumeType');
81: }
82:
83: /**
84: * returns a Snapshot object associated with this volume
85: *
86: * @return Snapshot
87: */
88: public function Snapshot($id = null)
89: {
90: return new Snapshot($this, $id);
91: }
92:
93: /**
94: * Returns a Collection of Snapshot objects
95: *
96: * @api
97: * @param boolean $detail TRUE to return full details
98: * @param array $filters array of filter key/value pairs
99: * @return Collection
100: */
101: public function SnapshotList($filter = array())
102: {
103: return $this->Collection('\OpenCloud\Volume\Snapshot');
104: }
105:
106: }
107: