|
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\NodeBalancer; |
|
15
|
|
|
|
|
16
|
|
|
use Linode\BaseLinodeApi; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* This class is autogenerated. |
|
20
|
|
|
* |
|
21
|
|
|
* @version Linode API v3.3 |
|
22
|
|
|
*/ |
|
23
|
|
|
class ConfigApi extends BaseLinodeApi |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* @param int $NodeBalancerID [required] The parent NodeBalancer's ID |
|
27
|
|
|
* @param int $Port [optional] Port to bind to on the public interfaces. 1-65534 |
|
28
|
|
|
* @param string $Protocol [optional] Either 'tcp', 'http', or 'https' |
|
29
|
|
|
* @param string $Algorithm [optional] Balancing algorithm. One of 'roundrobin', 'leastconn', 'source' |
|
30
|
|
|
* @param string $Stickiness [optional] Session persistence. One of 'none', 'table', 'http_cookie' |
|
31
|
|
|
* @param string $check [optional] Perform active health checks on the backend nodes. One of 'connection', 'http', 'http_body' |
|
32
|
|
|
* @param int $check_interval [optional] Seconds between health check probes. 2-3600 |
|
33
|
|
|
* @param string $check_timeout [optional] Seconds to wait before considering the probe a failure. 1-30. Must be less than check_interval. |
|
34
|
|
|
* @param string $check_attempts [optional] Number of failed probes before taking a node out of rotation. 1-30 |
|
35
|
|
|
* @param string $check_path [optional] When check=http, the path to request |
|
36
|
|
|
* @param string $check_body [optional] When check=http, a regex to match within the first 16,384 bytes of the response body |
|
37
|
|
|
* @param bool $check_passive [optional] Enable passive checks based on observing communication with back-end nodes. |
|
38
|
|
|
* @param string $ssl_cert [optional] SSL certificate served by the NodeBalancer when the protocol is 'https' |
|
39
|
|
|
* @param string $ssl_key [optional] Unpassphrased private key for the SSL certificate when protocol is 'https' |
|
40
|
|
|
* @param string $cipher_suite [optional] SSL cipher suite to enforce. One of 'recommended', 'legacy' |
|
41
|
|
|
* |
|
42
|
|
|
* @return array |
|
43
|
|
|
*/ |
|
44
|
1 |
|
public function create($NodeBalancerID, $Port = null, $Protocol = null, $Algorithm = null, $Stickiness = null, $check = null, $check_interval = null, $check_timeout = null, $check_attempts = null, $check_path = null, $check_body = null, $check_passive = null, $ssl_cert = null, $ssl_key = null, $cipher_suite = null) |
|
45
|
|
|
{ |
|
46
|
1 |
|
return $this->call('nodebalancer.config.create', [ |
|
|
|
|
|
|
47
|
1 |
|
'NodeBalancerID' => $NodeBalancerID, |
|
48
|
1 |
|
'Port' => $Port, |
|
49
|
1 |
|
'Protocol' => $Protocol, |
|
50
|
1 |
|
'Algorithm' => $Algorithm, |
|
51
|
1 |
|
'Stickiness' => $Stickiness, |
|
52
|
1 |
|
'check' => $check, |
|
53
|
1 |
|
'check_interval' => $check_interval, |
|
54
|
1 |
|
'check_timeout' => $check_timeout, |
|
55
|
1 |
|
'check_attempts' => $check_attempts, |
|
56
|
1 |
|
'check_path' => $check_path, |
|
57
|
1 |
|
'check_body' => $check_body, |
|
58
|
1 |
|
'check_passive' => $check_passive, |
|
59
|
1 |
|
'ssl_cert' => $ssl_cert, |
|
60
|
1 |
|
'ssl_key' => $ssl_key, |
|
61
|
1 |
|
'cipher_suite' => $cipher_suite, |
|
62
|
|
|
]); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Deletes a NodeBalancer's Config. |
|
67
|
|
|
* |
|
68
|
|
|
* @param int $NodeBalancerID [required] |
|
69
|
|
|
* @param int $ConfigID [required] The ConfigID to delete |
|
70
|
|
|
* |
|
71
|
|
|
* @return array |
|
72
|
|
|
*/ |
|
73
|
1 |
|
public function delete($NodeBalancerID, $ConfigID) |
|
74
|
|
|
{ |
|
75
|
1 |
|
return $this->call('nodebalancer.config.delete', [ |
|
|
|
|
|
|
76
|
1 |
|
'NodeBalancerID' => $NodeBalancerID, |
|
77
|
1 |
|
'ConfigID' => $ConfigID, |
|
78
|
|
|
]); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Returns a list of NodeBalancers this user has access or delete to, including their properties. |
|
83
|
|
|
* |
|
84
|
|
|
* @param int $NodeBalancerID [required] |
|
85
|
|
|
* @param int $ConfigID [optional] Limits the list to the specified ConfigID |
|
86
|
|
|
* |
|
87
|
|
|
* @return array |
|
88
|
|
|
*/ |
|
89
|
1 |
|
public function getList($NodeBalancerID, $ConfigID = null) |
|
90
|
|
|
{ |
|
91
|
1 |
|
return $this->call('nodebalancer.config.list', [ |
|
|
|
|
|
|
92
|
1 |
|
'NodeBalancerID' => $NodeBalancerID, |
|
93
|
1 |
|
'ConfigID' => $ConfigID, |
|
94
|
|
|
]); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Updates a Config's properties. |
|
99
|
|
|
* |
|
100
|
|
|
* @param int $ConfigID [required] |
|
101
|
|
|
* @param int $Port [optional] Port to bind to on the public interfaces. 1-65534 |
|
102
|
|
|
* @param string $Protocol [optional] Either 'tcp', 'http', or 'https' |
|
103
|
|
|
* @param string $Algorithm [optional] Balancing algorithm. One of 'roundrobin', 'leastconn', 'source' |
|
104
|
|
|
* @param string $Stickiness [optional] Session persistence. One of 'none', 'table', 'http_cookie' |
|
105
|
|
|
* @param string $check [optional] Perform active health checks on the backend nodes. One of 'connection', 'http', 'http_body' |
|
106
|
|
|
* @param int $check_interval [optional] Seconds between health check probes. 2-3600 |
|
107
|
|
|
* @param string $check_timeout [optional] Seconds to wait before considering the probe a failure. 1-30. Must be less than check_interval. |
|
108
|
|
|
* @param string $check_attempts [optional] Number of failed probes before taking a node out of rotation. 1-30 |
|
109
|
|
|
* @param string $check_path [optional] When check=http, the path to request |
|
110
|
|
|
* @param string $check_body [optional] When check=http, a regex to match within the first 16,384 bytes of the response body |
|
111
|
|
|
* @param bool $check_passive [optional] Enable passive checks based on observing communication with back-end nodes. |
|
112
|
|
|
* @param string $ssl_cert [optional] SSL certificate served by the NodeBalancer when the protocol is 'https' |
|
113
|
|
|
* @param string $ssl_key [optional] Unpassphrased private key for the SSL certificate when protocol is 'https' |
|
114
|
|
|
* @param string $cipher_suite [optional] SSL cipher suite to enforce. One of 'recommended', 'legacy' |
|
115
|
|
|
* |
|
116
|
|
|
* @return array |
|
117
|
|
|
*/ |
|
118
|
1 |
|
public function update($ConfigID, $Port = null, $Protocol = null, $Algorithm = null, $Stickiness = null, $check = null, $check_interval = null, $check_timeout = null, $check_attempts = null, $check_path = null, $check_body = null, $check_passive = null, $ssl_cert = null, $ssl_key = null, $cipher_suite = null) |
|
119
|
|
|
{ |
|
120
|
1 |
|
return $this->call('nodebalancer.config.update', [ |
|
|
|
|
|
|
121
|
1 |
|
'ConfigID' => $ConfigID, |
|
122
|
1 |
|
'Port' => $Port, |
|
123
|
1 |
|
'Protocol' => $Protocol, |
|
124
|
1 |
|
'Algorithm' => $Algorithm, |
|
125
|
1 |
|
'Stickiness' => $Stickiness, |
|
126
|
1 |
|
'check' => $check, |
|
127
|
1 |
|
'check_interval' => $check_interval, |
|
128
|
1 |
|
'check_timeout' => $check_timeout, |
|
129
|
1 |
|
'check_attempts' => $check_attempts, |
|
130
|
1 |
|
'check_path' => $check_path, |
|
131
|
1 |
|
'check_body' => $check_body, |
|
132
|
1 |
|
'check_passive' => $check_passive, |
|
133
|
1 |
|
'ssl_cert' => $ssl_cert, |
|
134
|
1 |
|
'ssl_key' => $ssl_key, |
|
135
|
1 |
|
'cipher_suite' => $cipher_suite, |
|
136
|
|
|
]); |
|
137
|
|
|
} |
|
138
|
|
|
} |
|
139
|
|
|
|