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

NodeApi   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 0
Metric Value
wmc 4
c 5
b 0
f 0
lcom 1
cbo 1
dl 0
loc 74
ccs 25
cts 25
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 1
A delete() 0 6 1
A getList() 0 7 1
A update() 0 10 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\NodeBalancer;
15
16
use Linode\BaseLinodeApi;
17
18
/**
19
 * This class is autogenerated.
20
 *
21
 * @version Linode API v3.3
22
 */
23
class NodeApi extends BaseLinodeApi
24
{
25
    /**
26
     * @param int    $ConfigID [required] The parent ConfigID to attach this Node to
27
     * @param string $Label    [required] This backend Node's label
28
     * @param string $Address  [required] The address:port combination used to communicate with this Node
29
     * @param int    $Weight   [optional] Load balancing weight, 1-255. Higher means more connections.
30
     * @param string $Mode     [optional] The connections mode for this node.  One of 'accept', 'reject', or 'drain'
31
     *
32
     * @return array
33
     */
34 1
    public function create($ConfigID, $Label, $Address, $Weight = null, $Mode = null)
35
    {
36 1
        return $this->call('nodebalancer.node.create', [
37 1
            'ConfigID' => $ConfigID,
38 1
            'Label'    => $Label,
39 1
            'Address'  => $Address,
40 1
            'Weight'   => $Weight,
41 1
            'Mode'     => $Mode,
42 1
        ]);
43
    }
44
45
    /**
46
     * Deletes a Node from a NodeBalancer Config.
47
     *
48
     * @param int $NodeID [required] The NodeID to delete
49
     *
50
     * @return array
51
     */
52 1
    public function delete($NodeID)
53
    {
54 1
        return $this->call('nodebalancer.node.delete', [
55 1
            'NodeID' => $NodeID,
56 1
        ]);
57
    }
58
59
    /**
60
     * Returns a list of Nodes associated with a NodeBalancer Config.
61
     *
62
     * @param int $ConfigID [required] 
63
     * @param int $NodeID   [optional] Limits the list to the specified NodeID
64
     *
65
     * @return array
66
     */
67 1
    public function getList($ConfigID, $NodeID = null)
68
    {
69 1
        return $this->call('nodebalancer.node.list', [
70 1
            'ConfigID' => $ConfigID,
71 1
            'NodeID'   => $NodeID,
72 1
        ]);
73
    }
74
75
    /**
76
     * Updates a Node's properties.
77
     *
78
     * @param int    $NodeID  [required] 
79
     * @param string $Label   [optional] This backend Node's label
80
     * @param string $Address [optional] The address:port combination used to communicate with this Node
81
     * @param int    $Weight  [optional] Load balancing weight, 1-255. Higher means more connections.
82
     * @param string $Mode    [optional] The connections mode for this node.  One of 'accept', 'reject', or 'drain'
83
     *
84
     * @return array
85
     */
86 1
    public function update($NodeID, $Label = null, $Address = null, $Weight = null, $Mode = null)
87
    {
88 1
        return $this->call('nodebalancer.node.update', [
89 1
            'NodeID'  => $NodeID,
90 1
            'Label'   => $Label,
91 1
            'Address' => $Address,
92 1
            'Weight'  => $Weight,
93 1
            'Mode'    => $Mode,
94 1
        ]);
95
    }
96
}
97