1: <?php
2: /**
3: * PHP OpenCloud library.
4: *
5: * @copyright Copyright 2013 Rackspace US, Inc. See COPYING for licensing information.
6: * @license https://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
7: * @version 1.6.0
8: * @author Glen Campbell <glen.campbell@rackspace.com>
9: * @author Jamie Hannaford <jamie.hannaford@rackspace.com>
10: */
11:
12: namespace OpenCloud\LoadBalancer\Resource;
13:
14: /**
15: * The connection throttling feature imposes limits on the number of connections
16: * per IP address to help mitigate malicious or abusive traffic to your
17: * applications. The attributes in the table that follows can be configured
18: * based on the traffic patterns for your sites.
19: */
20: class ConnectionThrottle extends SubResource
21: {
22: /**
23: * Allow at least this number of connections per IP address before applying
24: * throttling restrictions. Setting a value of 0 allows unlimited
25: * simultaneous connections; otherwise, set a value between 1 and 1000.
26: *
27: * @var int
28: */
29: public $minConnections;
30:
31: /**
32: * Maximum number of connections to allow for a single IP address. Setting a
33: * value of 0 will allow unlimited simultaneous connections; otherwise set a
34: * value between 1 and 100000.
35: *
36: * @var int
37: */
38: public $maxConnections;
39:
40: /**
41: * Maximum number of connections allowed from a single IP address in the
42: * defined rateInterval. Setting a value of 0 allows an unlimited connection
43: * rate; otherwise, set a value between 1 and 100000.
44: *
45: * @var int
46: */
47: public $maxConnectionRate;
48:
49: /**
50: * Frequency (in seconds) at which the maxConnectionRate is assessed.
51: * For example, a maxConnectionRate of 30 with a rateInterval of 60 would
52: * allow a maximum of 30 connections per minute for a single IP address.
53: * This value must be between 1 and 3600.
54: *
55: * @var int
56: */
57: public $rateInterval;
58:
59: protected static $json_name = "connectionThrottle";
60: protected static $url_resource = "connectionthrottle";
61:
62: protected $createKeys = array(
63: 'minConnections',
64: 'maxConnections',
65: 'maxConnectionRate',
66: 'rateInterval'
67: );
68:
69: /**
70: * create uses PUT like Update
71: */
72: public function create($params = array())
73: {
74: return $this->update($params);
75: }
76:
77: }
78: