webinarium /
linode-api3
| 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\Linode; |
||
| 15 | |||
| 16 | use Linode\BaseLinodeApi; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * This class is autogenerated. |
||
| 20 | * |
||
| 21 | * @version Linode API v3.3 |
||
| 22 | */ |
||
| 23 | class DiskApi extends BaseLinodeApi |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * @param int $LinodeID [required] |
||
| 27 | * @param string $Label [required] The display label for this Disk |
||
| 28 | * @param string $Type [required] The formatted type of this disk. Valid types are: ext3, ext4, swap, raw |
||
| 29 | * @param int $Size [required] The size in MB of this Disk. |
||
| 30 | * @param bool $isReadOnly [optional] Enable forced read-only for this Disk |
||
| 31 | * |
||
| 32 | * @return array |
||
| 33 | */ |
||
| 34 | 1 | public function create($LinodeID, $Label, $Type, $Size, $isReadOnly = null) |
|
| 35 | { |
||
| 36 | 1 | return $this->call('linode.disk.create', [ |
|
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 37 | 1 | 'LinodeID' => $LinodeID, |
|
| 38 | 1 | 'Label' => $Label, |
|
| 39 | 1 | 'Type' => $Type, |
|
| 40 | 1 | 'Size' => $Size, |
|
| 41 | 1 | 'isReadOnly' => $isReadOnly, |
|
| 42 | ]); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param int $LinodeID [required] |
||
| 47 | * @param int $DistributionID [required] The DistributionID to create this disk from. Found in avail.distributions() |
||
| 48 | * @param string $Label [required] The label of this new disk image |
||
| 49 | * @param int $Size [required] Size of this disk image in MB |
||
| 50 | * @param string $rootPass [required] The root (or core) user's password |
||
| 51 | * @param string $rootSSHKey [optional] Optionally sets this string into /root/.ssh/authorized_keys (or /home/core/.ssh/authorized_keys) upon distribution configuration. |
||
| 52 | * |
||
| 53 | * @return array |
||
| 54 | */ |
||
| 55 | 1 | public function createFromDistribution($LinodeID, $DistributionID, $Label, $Size, $rootPass, $rootSSHKey = null) |
|
| 56 | { |
||
| 57 | 1 | return $this->call('linode.disk.createfromdistribution', [ |
|
|
0 ignored issues
–
show
|
|||
| 58 | 1 | 'LinodeID' => $LinodeID, |
|
| 59 | 1 | 'DistributionID' => $DistributionID, |
|
| 60 | 1 | 'Label' => $Label, |
|
| 61 | 1 | 'Size' => $Size, |
|
| 62 | 1 | 'rootPass' => $rootPass, |
|
| 63 | 1 | 'rootSSHKey' => $rootSSHKey, |
|
| 64 | ]); |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Creates a new disk from a previously imagized disk. |
||
| 69 | * |
||
| 70 | * @param int $LinodeID [required] Specifies the Linode to deploy on to |
||
| 71 | * @param int $ImageID [required] The ID of the frozen image to deploy from |
||
| 72 | * @param string $Label [optional] The label of this new disk image |
||
| 73 | * @param int $size [optional] The size of the disk image to creates. Defaults to the minimum size required for the requested image |
||
| 74 | * @param string $rootPass [optional] Optionally sets the root password at deployment time. If a password is not provided the existing root password of the frozen image will not be modified |
||
| 75 | * @param string $rootSSHKey [optional] Optionally sets this string into /root/.ssh/authorized_keys upon image deployment |
||
| 76 | * |
||
| 77 | * @return array |
||
| 78 | */ |
||
| 79 | 1 | public function createFromImage($LinodeID, $ImageID, $Label = null, $size = null, $rootPass = null, $rootSSHKey = null) |
|
| 80 | { |
||
| 81 | 1 | return $this->call('linode.disk.createfromimage', [ |
|
|
0 ignored issues
–
show
|
|||
| 82 | 1 | 'LinodeID' => $LinodeID, |
|
| 83 | 1 | 'ImageID' => $ImageID, |
|
| 84 | 1 | 'Label' => $Label, |
|
| 85 | 1 | 'size' => $size, |
|
| 86 | 1 | 'rootPass' => $rootPass, |
|
| 87 | 1 | 'rootSSHKey' => $rootSSHKey, |
|
| 88 | ]); |
||
| 89 | } |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @param int $LinodeID [required] |
||
| 93 | * @param int $StackScriptID [required] The StackScript to create this image from |
||
| 94 | * @param string $StackScriptUDFResponses [required] JSON encoded name/value pairs, answering this StackScript's User Defined Fields |
||
| 95 | * @param int $DistributionID [required] Which Distribution to apply this StackScript to. Must be one from the script's DistributionIDList |
||
| 96 | * @param string $Label [required] The label of this new disk image |
||
| 97 | * @param int $Size [required] Size of this disk image in MB |
||
| 98 | * @param string $rootPass [required] The root user's password |
||
| 99 | * @param string $rootSSHKey [optional] Optionally sets this string into /root/.ssh/authorized_keys upon distribution configuration. |
||
| 100 | * |
||
| 101 | * @return array |
||
| 102 | */ |
||
| 103 | 1 | public function createFromStackScript($LinodeID, $StackScriptID, $StackScriptUDFResponses, $DistributionID, $Label, $Size, $rootPass, $rootSSHKey = null) |
|
| 104 | { |
||
| 105 | 1 | return $this->call('linode.disk.createfromstackscript', [ |
|
|
0 ignored issues
–
show
|
|||
| 106 | 1 | 'LinodeID' => $LinodeID, |
|
| 107 | 1 | 'StackScriptID' => $StackScriptID, |
|
| 108 | 1 | 'StackScriptUDFResponses' => $StackScriptUDFResponses, |
|
| 109 | 1 | 'DistributionID' => $DistributionID, |
|
| 110 | 1 | 'Label' => $Label, |
|
| 111 | 1 | 'Size' => $Size, |
|
| 112 | 1 | 'rootPass' => $rootPass, |
|
| 113 | 1 | 'rootSSHKey' => $rootSSHKey, |
|
| 114 | ]); |
||
| 115 | } |
||
| 116 | |||
| 117 | /** |
||
| 118 | * @param int $LinodeID [required] |
||
| 119 | * @param int $DiskID [required] |
||
| 120 | * |
||
| 121 | * @return array |
||
| 122 | */ |
||
| 123 | 1 | public function delete($LinodeID, $DiskID) |
|
| 124 | { |
||
| 125 | 1 | return $this->call('linode.disk.delete', [ |
|
|
0 ignored issues
–
show
|
|||
| 126 | 1 | 'LinodeID' => $LinodeID, |
|
| 127 | 1 | 'DiskID' => $DiskID, |
|
| 128 | ]); |
||
| 129 | } |
||
| 130 | |||
| 131 | /** |
||
| 132 | * Performs a bit-for-bit copy of a disk image. |
||
| 133 | * |
||
| 134 | * @param int $LinodeID [required] |
||
| 135 | * @param int $DiskID [required] |
||
| 136 | * |
||
| 137 | * @return array |
||
| 138 | */ |
||
| 139 | 1 | public function duplicate($LinodeID, $DiskID) |
|
| 140 | { |
||
| 141 | 1 | return $this->call('linode.disk.duplicate', [ |
|
|
0 ignored issues
–
show
|
|||
| 142 | 1 | 'LinodeID' => $LinodeID, |
|
| 143 | 1 | 'DiskID' => $DiskID, |
|
| 144 | ]); |
||
| 145 | } |
||
| 146 | |||
| 147 | /** |
||
| 148 | * Status values are 1: Ready and 2: Being Deleted. |
||
| 149 | * |
||
| 150 | * @param int $LinodeID [required] |
||
| 151 | * @param int $DiskID [optional] |
||
| 152 | * |
||
| 153 | * @return array |
||
| 154 | */ |
||
| 155 | 1 | public function getList($LinodeID, $DiskID = null) |
|
| 156 | { |
||
| 157 | 1 | return $this->call('linode.disk.list', [ |
|
|
0 ignored issues
–
show
|
|||
| 158 | 1 | 'LinodeID' => $LinodeID, |
|
| 159 | 1 | 'DiskID' => $DiskID, |
|
| 160 | ]); |
||
| 161 | } |
||
| 162 | |||
| 163 | /** |
||
| 164 | * Creates a gold-master image for future deployments. |
||
| 165 | * |
||
| 166 | * @param int $LinodeID [required] Specifies the source Linode to create the image from |
||
| 167 | * @param int $DiskID [required] Specifies the source Disk to create the image from |
||
| 168 | * @param string $Label [optional] Sets the name of the image shown in the base image list, defaults to the source image label |
||
| 169 | * @param string $Description [optional] An optional description of the created image |
||
| 170 | * |
||
| 171 | * @return array |
||
| 172 | */ |
||
| 173 | 1 | public function imagize($LinodeID, $DiskID, $Label = null, $Description = null) |
|
| 174 | { |
||
| 175 | 1 | return $this->call('linode.disk.imagize', [ |
|
|
0 ignored issues
–
show
|
|||
| 176 | 1 | 'LinodeID' => $LinodeID, |
|
| 177 | 1 | 'DiskID' => $DiskID, |
|
| 178 | 1 | 'Label' => $Label, |
|
| 179 | 1 | 'Description' => $Description, |
|
| 180 | ]); |
||
| 181 | } |
||
| 182 | |||
| 183 | /** |
||
| 184 | * @param int $LinodeID [required] |
||
| 185 | * @param int $DiskID [required] |
||
| 186 | * @param int $size [required] The requested new size of this Disk in MB |
||
| 187 | * |
||
| 188 | * @return array |
||
| 189 | */ |
||
| 190 | 1 | public function resize($LinodeID, $DiskID, $size) |
|
| 191 | { |
||
| 192 | 1 | return $this->call('linode.disk.resize', [ |
|
|
0 ignored issues
–
show
|
|||
| 193 | 1 | 'LinodeID' => $LinodeID, |
|
| 194 | 1 | 'DiskID' => $DiskID, |
|
| 195 | 1 | 'size' => $size, |
|
| 196 | ]); |
||
| 197 | } |
||
| 198 | |||
| 199 | /** |
||
| 200 | * @param int $LinodeID [optional] |
||
| 201 | * @param int $DiskID [required] |
||
| 202 | * @param string $Label [optional] The display label for this Disk |
||
| 203 | * @param bool $isReadOnly [optional] Enable forced read-only for this Disk |
||
| 204 | * |
||
| 205 | * @return array |
||
| 206 | */ |
||
| 207 | 1 | public function update($LinodeID, $DiskID, $Label = null, $isReadOnly = null) |
|
| 208 | { |
||
| 209 | 1 | return $this->call('linode.disk.update', [ |
|
|
0 ignored issues
–
show
|
|||
| 210 | 1 | 'LinodeID' => $LinodeID, |
|
| 211 | 1 | 'DiskID' => $DiskID, |
|
| 212 | 1 | 'Label' => $Label, |
|
| 213 | 1 | 'isReadOnly' => $isReadOnly, |
|
| 214 | ]); |
||
| 215 | } |
||
| 216 | } |
||
| 217 |