1: <?php
2: /**
3: * Copyright 2012-2014 Rackspace US, Inc.
4: *
5: * Licensed under the Apache License, Version 2.0 (the "License");
6: * you may not use this file except in compliance with the License.
7: * You may obtain a copy of the License at
8: *
9: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: namespace OpenCloud\LoadBalancer\Resource;
19:
20: /**
21: * The connection throttling feature imposes limits on the number of connections
22: * per IP address to help mitigate malicious or abusive traffic to your
23: * applications. The attributes in the table that follows can be configured
24: * based on the traffic patterns for your sites.
25: */
26: class ConnectionThrottle extends NonIdUriResource
27: {
28: /**
29: * Allow at least this number of connections per IP address before applying
30: * throttling restrictions. Setting a value of 0 allows unlimited
31: * simultaneous connections; otherwise, set a value between 1 and 1000.
32: *
33: * @var int
34: */
35: public $minConnections;
36:
37: /**
38: * Maximum number of connections to allow for a single IP address. Setting a
39: * value of 0 will allow unlimited simultaneous connections; otherwise set a
40: * value between 1 and 100000.
41: *
42: * @var int
43: */
44: public $maxConnections;
45:
46: /**
47: * Maximum number of connections allowed from a single IP address in the
48: * defined rateInterval. Setting a value of 0 allows an unlimited connection
49: * rate; otherwise, set a value between 1 and 100000.
50: *
51: * @var int
52: */
53: public $maxConnectionRate;
54:
55: /**
56: * Frequency (in seconds) at which the maxConnectionRate is assessed.
57: * For example, a maxConnectionRate of 30 with a rateInterval of 60 would
58: * allow a maximum of 30 connections per minute for a single IP address.
59: * This value must be between 1 and 3600.
60: *
61: * @var int
62: */
63: public $rateInterval;
64:
65: protected static $json_name = "connectionThrottle";
66: protected static $url_resource = "connectionthrottle";
67:
68: protected $createKeys = array(
69: 'minConnections',
70: 'maxConnections',
71: 'maxConnectionRate',
72: 'rateInterval'
73: );
74:
75: public function create($params = array())
76: {
77: return $this->update($params);
78: }
79: }
80: