Completed
Push — master ( d0d40f...472735 )
by Artem
02:46
created

LinodeApi::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 3
crap 1
1
<?php
2
3
//----------------------------------------------------------------------
4
//
5
//  Copyright (C) 2015-2016 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 LinodeApi extends BaseLinodeApi
22
{
23
    /**
24
     * Issues a boot job for the provided ConfigID.  If no ConfigID is provided boots the last used
25
     * configuration profile, or the first configuration profile if this Linode has never been booted.
26
     *
27
     * @param int $LinodeID [required] 
28
     * @param int $ConfigID [optional] The ConfigID to boot, available from linode.config.list().
29
     *
30
     * @return array
31
     */
32 1
    public function boot($LinodeID, $ConfigID = null)
33
    {
34 1
        return $this->call('linode.boot', [
35 1
            'LinodeID' => $LinodeID,
36 1
            'ConfigID' => $ConfigID,
37 1
        ]);
38
    }
39
40
    /**
41
     * Creates a Linode and assigns you full privileges. There is a 75-linodes-per-hour limiter.
42
     *
43
     * @param int $DatacenterID [required] The DatacenterID from avail.datacenters() where you wish to place this new Linode
44
     * @param int $PlanID       [required] The desired PlanID available from avail.LinodePlans()
45
     * @param int $PaymentTerm  [optional] Subscription term in months for prepaid customers.  One of: 1, 12, or 24
46
     *
47
     * @return array
48
     */
49 2
    public function create($DatacenterID, $PlanID, $PaymentTerm = null)
50
    {
51 2
        return $this->call('linode.create', [
52 2
            'DatacenterID' => $DatacenterID,
53 2
            'PlanID'       => $PlanID,
54 2
            'PaymentTerm'  => $PaymentTerm,
55 2
        ]);
56
    }
57
58
    /**
59
     * Immediately removes a Linode from your account and issues a pro-rated credit back to your account,
60
     * if applicable.  To prevent accidental deletes, this requires the Linode has no Disk images.  You
61
     * must first delete its disk images.".
62
     *
63
     * @param int  $LinodeID   [required] The LinodeID to delete
64
     * @param bool $skipChecks [optional] Skips the safety checks and will always delete the Linode
65
     *
66
     * @return array
67
     */
68 1
    public function delete($LinodeID, $skipChecks = null)
69
    {
70 1
        return $this->call('linode.delete', [
71 1
            'LinodeID'   => $LinodeID,
72 1
            'skipChecks' => $skipChecks,
73 1
        ]);
74
    }
75
76
    /**
77
     * Creates a new Linode, assigns you full privileges, and then clones the specified LinodeID to the new
78
     * Linode. There is a limit of 5 active clone operations per source Linode.  It is recommended that the
79
     * source Linode be powered down during the clone.
80
     *
81
     * @param int $LinodeID     [required] The LinodeID that you want cloned
82
     * @param int $DatacenterID [required] The DatacenterID from avail.datacenters() where you wish to place this new Linode
83
     * @param int $PlanID       [required] The desired PlanID available from avail.LinodePlans()
84
     * @param int $PaymentTerm  [optional] Subscription term in months for prepaid customers.  One of: 1, 12, or 24
85
     *
86
     * @return array
87
     */
88 1
    public function duplicate($LinodeID, $DatacenterID, $PlanID, $PaymentTerm = null)
89
    {
90 1
        return $this->call('linode.clone', [
91 1
            'LinodeID'     => $LinodeID,
92 1
            'DatacenterID' => $DatacenterID,
93 1
            'PlanID'       => $PlanID,
94 1
            'PaymentTerm'  => $PaymentTerm,
95 1
        ]);
96
    }
97
98
    /**
99
     * Returns a list of all Linodes user has access or delete to, including some properties.  Status
100
     * values are -1: Being Created, 0: Brand New, 1: Running, and 2: Powered Off.
101
     *
102
     * @param int $LinodeID [optional] Limits the list to the specified LinodeID
103
     *
104
     * @return array
105
     */
106 1
    public function getList($LinodeID = null)
107
    {
108 1
        return $this->call('linode.list', [
109 1
            'LinodeID' => $LinodeID,
110 1
        ]);
111
    }
112
113
    /**
114
     * Upgrades a Linode to its next generation.
115
     *
116
     * @param int $LinodeID [required] 
117
     *
118
     * @return array
119
     */
120 1
    public function mutate($LinodeID)
121
    {
122 1
        return $this->call('linode.mutate', [
123 1
            'LinodeID' => $LinodeID,
124 1
        ]);
125
    }
126
127
    /**
128
     * Issues a shutdown, and then boot job for a given LinodeID.
129
     *
130
     * @param int $LinodeID [required] 
131
     * @param int $ConfigID [optional] 
132
     *
133
     * @return array
134
     */
135 1
    public function reboot($LinodeID, $ConfigID = null)
136
    {
137 1
        return $this->call('linode.reboot', [
138 1
            'LinodeID' => $LinodeID,
139 1
            'ConfigID' => $ConfigID,
140 1
        ]);
141
    }
142
143
    /**
144
     * Resizes a Linode from one plan to another.  Immediately shuts the Linode down, charges/credits the
145
     * account, and issue a migration to another host server.
146
     *
147
     * @param int $LinodeID [required] 
148
     * @param int $PlanID   [required] The desired PlanID available from avail.LinodePlans()
149
     *
150
     * @return array
151
     */
152 1
    public function resize($LinodeID, $PlanID)
153
    {
154 1
        return $this->call('linode.resize', [
155 1
            'LinodeID' => $LinodeID,
156 1
            'PlanID'   => $PlanID,
157 1
        ]);
158
    }
159
160
    /**
161
     * Issues a shutdown job for a given LinodeID.
162
     *
163
     * @param int $LinodeID [required] 
164
     *
165
     * @return array
166
     */
167 1
    public function shutdown($LinodeID)
168
    {
169 1
        return $this->call('linode.shutdown', [
170 1
            'LinodeID' => $LinodeID,
171 1
        ]);
172
    }
173
174
    /**
175
     * Updates a Linode's properties.
176
     *
177
     * @param int    $LinodeID                [required] 
178
     * @param string $Label                   [optional] This Linode's label
179
     * @param string $lpm_displayGroup        [optional] Display group in the Linode list inside the Linode Manager
180
     * @param bool   $Alert_cpu_enabled       [optional] Enable the cpu usage email alert
181
     * @param int    $Alert_cpu_threshold     [optional] CPU Alert threshold, percentage 0-800
182
     * @param bool   $Alert_diskio_enabled    [optional] Enable the disk IO email alert
183
     * @param int    $Alert_diskio_threshold  [optional] IO ops/sec
184
     * @param bool   $Alert_bwin_enabled      [optional] Enable the incoming bandwidth email alert
185
     * @param int    $Alert_bwin_threshold    [optional] Mb/sec
186
     * @param bool   $Alert_bwout_enabled     [optional] Enable the outgoing bandwidth email alert
187
     * @param int    $Alert_bwout_threshold   [optional] Mb/sec
188
     * @param bool   $Alert_bwquota_enabled   [optional] Enable the bw quote email alert
189
     * @param int    $Alert_bwquota_threshold [optional] Percentage of monthly bw quota
190
     * @param int    $backupWindow            [optional] 
191
     * @param int    $backupWeeklyDay         [optional] 
192
     * @param bool   $watchdog                [optional] Enable the Lassie shutdown watchdog
193
     * @param bool   $ms_ssh_disabled         [optional] 
194
     * @param string $ms_ssh_user             [optional] 
195
     * @param string $ms_ssh_ip               [optional] 
196
     * @param int    $ms_ssh_port             [optional] 
197
     *
198
     * @return array
199
     */
200 1
    public function update($LinodeID, $Label = null, $lpm_displayGroup = null, $Alert_cpu_enabled = null, $Alert_cpu_threshold = null, $Alert_diskio_enabled = null, $Alert_diskio_threshold = null, $Alert_bwin_enabled = null, $Alert_bwin_threshold = null, $Alert_bwout_enabled = null, $Alert_bwout_threshold = null, $Alert_bwquota_enabled = null, $Alert_bwquota_threshold = null, $backupWindow = null, $backupWeeklyDay = null, $watchdog = null, $ms_ssh_disabled = null, $ms_ssh_user = null, $ms_ssh_ip = null, $ms_ssh_port = null)
201
    {
202 1
        return $this->call('linode.update', [
203 1
            'LinodeID'                => $LinodeID,
204 1
            'Label'                   => $Label,
205 1
            'lpm_displayGroup'        => $lpm_displayGroup,
206 1
            'Alert_cpu_enabled'       => $Alert_cpu_enabled,
207 1
            'Alert_cpu_threshold'     => $Alert_cpu_threshold,
208 1
            'Alert_diskio_enabled'    => $Alert_diskio_enabled,
209 1
            'Alert_diskio_threshold'  => $Alert_diskio_threshold,
210 1
            'Alert_bwin_enabled'      => $Alert_bwin_enabled,
211 1
            'Alert_bwin_threshold'    => $Alert_bwin_threshold,
212 1
            'Alert_bwout_enabled'     => $Alert_bwout_enabled,
213 1
            'Alert_bwout_threshold'   => $Alert_bwout_threshold,
214 1
            'Alert_bwquota_enabled'   => $Alert_bwquota_enabled,
215 1
            'Alert_bwquota_threshold' => $Alert_bwquota_threshold,
216 1
            'backupWindow'            => $backupWindow,
217 1
            'backupWeeklyDay'         => $backupWeeklyDay,
218 1
            'watchdog'                => $watchdog,
219 1
            'ms_ssh_disabled'         => $ms_ssh_disabled,
220 1
            'ms_ssh_user'             => $ms_ssh_user,
221 1
            'ms_ssh_ip'               => $ms_ssh_ip,
222 1
            'ms_ssh_port'             => $ms_ssh_port,
223 1
        ]);
224
    }
225
226
    /**
227
     * Generates a console token starting a web console LISH session for the requesting IP.
228
     *
229
     * @param int $LinodeID [required] 
230
     *
231
     * @return array
232
     */
233 1
    public function webConsoleToken($LinodeID)
234
    {
235 1
        return $this->call('linode.webconsoletoken', [
236 1
            'LinodeID' => $LinodeID,
237 1
        ]);
238
    }
239
}
240