Completed
Push — master ( 42966d...773fe1 )
by Artem
03:46
created

VolumeApi::getList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
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.
25
     *
26
     * @param int    $DatacenterID [required] 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 which this volume is attached 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
     * Returns a list of block storage Volumes.
59
     *
60
     * @param int $VolumeID [optional] Limits the list to the specified Volume
61
     *
62
     * @return array
63
     */
64 1
    public function getList($VolumeID = null)
65
    {
66 1
        return $this->call('volume.list', [
67 1
            'VolumeID' => $VolumeID,
68 1
        ]);
69
    }
70
71
    /**
72
     * Updates a volume's properties.
73
     *
74
     * @param int    $VolumeID [required] The volume to modify
75
     * @param string $Label    [optional] A unique name for the volume
76
     * @param int    $Size     [optional] Sets the new size of the new volume in GiB; volumes can only be made larger
77
     * @param int    $LinodeID [optional] The Linode to attach the volume to, or 0 to detach
78
     *
79
     * @return array
80
     */
81 1
    public function update($VolumeID, $Label = null, $Size = null, $LinodeID = null)
82
    {
83 1
        return $this->call('volume.update', [
84 1
            'VolumeID' => $VolumeID,
85 1
            'Label'    => $Label,
86 1
            'Size'     => $Size,
87 1
            'LinodeID' => $LinodeID,
88 1
        ]);
89
    }
90
}
91