1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Cloudflare\Zone; |
4
|
|
|
|
5
|
|
|
use Cloudflare\Api; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* CloudFlare API wrapper |
9
|
|
|
* |
10
|
|
|
* CTM Load Balancer |
11
|
|
|
* User-level Cloud Traffic Manager Load Balancer |
12
|
|
|
* |
13
|
|
|
* @author James Bell <[email protected]> |
14
|
|
|
* |
15
|
|
|
* @version 1 |
16
|
|
|
*/ |
17
|
|
|
class LoadBalancers extends Api |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* List load balancers |
21
|
|
|
* List configured load balancers |
22
|
|
|
* |
23
|
|
|
* @param string $zone_identifier |
24
|
|
|
*/ |
25
|
|
|
public function load_balancers($zone_identifier) |
26
|
|
|
{ |
27
|
|
|
return $this->get('/zones/'.$zone_identifier.'/load_balancers'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Create a load balancer |
32
|
|
|
* Create a new load balancer |
33
|
|
|
* |
34
|
|
|
* @param string $zone_identifier |
35
|
|
|
* @param string $name A hostname of the record that should provide load balancing capabilities. |
36
|
|
|
* If this name already exists as a DNS record in your CloudFlare DNS, |
37
|
|
|
* the existing record will take precedence over the Load Balancer. |
38
|
|
|
* @param string $global_policy ID of the Global Policy object. |
39
|
|
|
* @param string|null $description Object description. |
40
|
|
|
* @param int|null $ttl Time to live (TTL) of the DNS entry for the IP address returned |
41
|
|
|
* by this load balancer. |
42
|
|
|
* @param bool|null $proxied Whether the hostname should be grey clouded (False) or orange clouded (True). |
43
|
|
|
*/ |
44
|
|
|
public function create($zone_identifier, $name, $global_policy, $description = null, $ttl = null, $proxied = null) |
45
|
|
|
{ |
46
|
|
|
$data = [ |
47
|
|
|
'name' => $name, |
48
|
|
|
'global_policy' => $global_policy, |
49
|
|
|
'description' => $description, |
50
|
|
|
'ttl' => $ttl, |
51
|
|
|
'proxied' => $proxied, |
52
|
|
|
]; |
53
|
|
|
|
54
|
|
|
return $this->post('/zones/'.$zone_identifier.'/load_balancers', $data); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Load balancer details |
59
|
|
|
* Fetch a single configured load balancer |
60
|
|
|
* |
61
|
|
|
* @param string $zone_identifier |
|
|
|
|
62
|
|
|
* @param string $identifier |
63
|
|
|
*/ |
64
|
|
|
public function details($identifier) |
65
|
|
|
{ |
66
|
|
|
return $this->get('/zones/'.$zone_identifier.'/load_balancers/'.$identifier); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Modify a load balancer |
71
|
|
|
* Modify a configured load balancer |
72
|
|
|
* |
73
|
|
|
* @param string $zone_identifier |
74
|
|
|
* @param string $identifier |
75
|
|
|
* @param string|null $name A hostname of the record that should provide load balancing capabilities. |
76
|
|
|
* If this name already exists as a DNS record in your CloudFlare DNS, |
77
|
|
|
* the existing record will take precedence over the Load Balancer. |
78
|
|
|
* @param string|null $global_policy ID of the Global Policy object. |
79
|
|
|
* @param string|null $description Object description. |
80
|
|
|
* @param int|null $ttl Time to live (TTL) of the DNS entry for the IP address returned |
81
|
|
|
* by this load balancer. |
82
|
|
|
* @param bool|null $proxied Whether the hostname should be grey clouded (False) or orange clouded (True). |
83
|
|
|
*/ |
84
|
|
|
public function update($zone_identifier, $identifier, $name = null, $global_policy = null, $description = null, $ttl = null, $proxied = null) |
|
|
|
|
85
|
|
|
{ |
86
|
|
|
$data = [ |
87
|
|
|
'name' => $name, |
88
|
|
|
'global_policy' => $global_policy, |
89
|
|
|
'description' => $description, |
90
|
|
|
'ttl' => $ttl, |
91
|
|
|
'proxied' => $proxied, |
92
|
|
|
]; |
93
|
|
|
|
94
|
|
|
return $this->patch('/zones/'.$zone_identifier.'/load_balancers/'.$identifier, $data); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Delete a load balancer |
99
|
|
|
* Delete a configured load balancer |
100
|
|
|
* |
101
|
|
|
* @param string $zone_identifier |
102
|
|
|
* @param string $identifier |
103
|
|
|
*/ |
104
|
|
|
public function delete_load_balancer($zone_identifier, $identifier) |
105
|
|
|
{ |
106
|
|
|
return $this->delete('/zones/'.$zone_identifier.'/load_balancers/'.$identifier); |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.