1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
//---------------------------------------------------------------------- |
4
|
|
|
// |
5
|
|
|
// Copyright (C) 2015-2017 Artem Rodygin |
6
|
|
|
// |
7
|
|
|
// This file is part of Linode API Client Library for PHP. |
8
|
|
|
// |
9
|
|
|
// You should have received a copy of the MIT License along with |
10
|
|
|
// the library. If not, see <http://opensource.org/licenses/MIT>. |
11
|
|
|
// |
12
|
|
|
//---------------------------------------------------------------------- |
13
|
|
|
|
14
|
|
|
namespace Linode; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* This class is autogenerated. |
18
|
|
|
* |
19
|
|
|
* @version Linode API v3.3 |
20
|
|
|
*/ |
21
|
|
|
class VolumeApi extends BaseLinodeApi |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Creates a new block storage volume. One of DatacenterID or LinodeID is required. |
25
|
|
|
* |
26
|
|
|
* @param int $DatacenterID [optional] Sets the datacenter where the volume should be provisioned |
27
|
|
|
* @param string $Label [required] A unique name for the volume |
28
|
|
|
* @param int $Size [required] Sets the size of the new volume in GiB |
29
|
|
|
* @param int $LinodeID [optional] The Linode to attach this volume to |
30
|
|
|
* |
31
|
|
|
* @return array |
32
|
|
|
*/ |
33
|
1 |
|
public function create($DatacenterID, $Label, $Size, $LinodeID = null) |
34
|
|
|
{ |
35
|
1 |
|
return $this->call('volume.create', [ |
36
|
1 |
|
'DatacenterID' => $DatacenterID, |
37
|
1 |
|
'Label' => $Label, |
38
|
1 |
|
'Size' => $Size, |
39
|
1 |
|
'LinodeID' => $LinodeID, |
40
|
1 |
|
]); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Deletes a block storage volume. |
45
|
|
|
* |
46
|
|
|
* @param int $VolumeID [required] The VolumeID to delete |
47
|
|
|
* |
48
|
|
|
* @return array |
49
|
|
|
*/ |
50
|
1 |
|
public function delete($VolumeID) |
51
|
|
|
{ |
52
|
1 |
|
return $this->call('volume.delete', [ |
53
|
1 |
|
'VolumeID' => $VolumeID, |
54
|
1 |
|
]); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Clones an existing block storage volume. |
59
|
|
|
* |
60
|
|
|
* @param int $CloneFromID [required] |
61
|
|
|
* @param string $Label [required] A unique name for the new volume |
62
|
|
|
* |
63
|
|
|
* @return array |
64
|
|
|
*/ |
65
|
1 |
|
public function duplicate($CloneFromID, $Label) |
66
|
|
|
{ |
67
|
1 |
|
return $this->call('volume.clone', [ |
68
|
1 |
|
'CloneFromID' => $CloneFromID, |
69
|
1 |
|
'Label' => $Label, |
70
|
1 |
|
]); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Returns a list of block storage Volumes. |
75
|
|
|
* |
76
|
|
|
* @param int $VolumeID [optional] Limits the list to the specified Volume |
77
|
|
|
* |
78
|
|
|
* @return array |
79
|
|
|
*/ |
80
|
1 |
|
public function getList($VolumeID = null) |
81
|
|
|
{ |
82
|
1 |
|
return $this->call('volume.list', [ |
83
|
1 |
|
'VolumeID' => $VolumeID, |
84
|
1 |
|
]); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Updates a volume's properties. |
89
|
|
|
* |
90
|
|
|
* @param int $VolumeID [required] The volume to modify |
91
|
|
|
* @param string $Label [optional] A unique name for the volume |
92
|
|
|
* @param int $Size [optional] Sets the new size of the new volume in GiB; volumes can only be made larger |
93
|
|
|
* @param int $LinodeID [optional] The Linode this volume is attached to |
94
|
|
|
* |
95
|
|
|
* @return array |
96
|
|
|
*/ |
97
|
1 |
|
public function update($VolumeID, $Label = null, $Size = null, $LinodeID = null) |
98
|
|
|
{ |
99
|
1 |
|
return $this->call('volume.update', [ |
100
|
1 |
|
'VolumeID' => $VolumeID, |
101
|
1 |
|
'Label' => $Label, |
102
|
1 |
|
'Size' => $Size, |
103
|
1 |
|
'LinodeID' => $LinodeID, |
104
|
1 |
|
]); |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|