@@ -91,6 +91,9 @@ class LoadBalancer(BaseAPI):
9191 Args:
9292 name (str): The Load Balancer's name
9393 region (str): The slug identifier for a DigitalOcean region
94+ size (str): The size of the load balancer. The available sizes \
95+ are "lb-small", "lb-medium", or "lb-large". Once you have \
96+ created a load balancer, you can't change its size
9497 algorithm (str, optional): The load balancing algorithm to be \
9598 used. Currently, it must be either "round_robin" or \
9699 "least_connections"
@@ -100,6 +103,11 @@ class LoadBalancer(BaseAPI):
100103 redirect_http_to_https (bool, optional): A boolean indicating \
101104 whether HTTP requests to the Load Balancer should be \
102105 redirected to HTTPS
106+ enable_proxy_protocol (bool, optional): A boolean value indicating \
107+ whether PROXY Protocol is in use
108+ enable_backend_keepalive (bool, optional): A boolean value \
109+ indicating whether HTTP keepalive connections are maintained \
110+ to target Droplets.
103111 droplet_ids (obj:`list` of `int`): A list of IDs representing \
104112 Droplets to be added to the Load Balancer (mutually \
105113 exclusive with 'tag')
@@ -112,6 +120,7 @@ class LoadBalancer(BaseAPI):
112120 * id (str): An unique identifier for a LoadBalancer
113121 * ip (str): Public IP address for a LoadBalancer
114122 * region (str): The slug identifier for a DigitalOcean region
123+ * size (str): The size of the load balancer
115124 * algorithm (str, optional): The load balancing algorithm to be \
116125 used. Currently, it must be either "round_robin" or \
117126 "least_connections"
@@ -121,6 +130,11 @@ class LoadBalancer(BaseAPI):
121130 * redirect_http_to_https (bool, optional): A boolean indicating \
122131 whether HTTP requests to the Load Balancer should be \
123132 redirected to HTTPS
133+ * enable_proxy_protocol (bool, optional): A boolean value indicating \
134+ whether PROXY Protocol is in use
135+ * enable_backend_keepalive (bool, optional): A boolean value \
136+ indicating whether HTTP keepalive connections are maintained \
137+ to target Droplets.
124138 * droplet_ids (obj:`list` of `int`): A list of IDs representing \
125139 Droplets to be added to the Load Balancer
126140 * tag (str): A string representing a DigitalOcean Droplet tag
@@ -132,11 +146,14 @@ def __init__(self, *args, **kwargs):
132146 self .id = None
133147 self .name = None
134148 self .region = None
149+ self .size = None
135150 self .algorithm = None
136151 self .forwarding_rules = []
137152 self .health_check = None
138153 self .sticky_sessions = None
139154 self .redirect_http_to_https = False
155+ self .enable_proxy_protocol = False
156+ self .enable_backend_keepalive = False
140157 self .droplet_ids = []
141158 self .tag = None
142159 self .status = None
@@ -195,6 +212,9 @@ def create(self, *args, **kwargs):
195212 Args:
196213 name (str): The Load Balancer's name
197214 region (str): The slug identifier for a DigitalOcean region
215+ size (str): The size of the load balancer. The available sizes
216+ are "lb-small", "lb-medium", or "lb-large". Once you have
217+ created a load balancer, you can't change its size
198218 algorithm (str, optional): The load balancing algorithm to be
199219 used. Currently, it must be either "round_robin" or
200220 "least_connections"
@@ -204,6 +224,11 @@ def create(self, *args, **kwargs):
204224 redirect_http_to_https (bool, optional): A boolean indicating
205225 whether HTTP requests to the Load Balancer should be
206226 redirected to HTTPS
227+ enable_proxy_protocol (bool, optional): A boolean value indicating
228+ whether PROXY Protocol is in use
229+ enable_backend_keepalive (bool, optional): A boolean value
230+ indicating whether HTTP keepalive connections are maintained
231+ to target Droplets.
207232 droplet_ids (obj:`list` of `int`): A list of IDs representing
208233 Droplets to be added to the Load Balancer (mutually
209234 exclusive with 'tag')
@@ -215,8 +240,11 @@ def create(self, *args, **kwargs):
215240 rules_dict = [rule .__dict__ for rule in self .forwarding_rules ]
216241
217242 params = {'name' : self .name , 'region' : self .region ,
243+ 'size' : self .size ,
218244 'forwarding_rules' : rules_dict ,
219245 'redirect_http_to_https' : self .redirect_http_to_https ,
246+ 'enable_proxy_protocol' : self .enable_proxy_protocol ,
247+ 'enable_backend_keepalive' : self .enable_backend_keepalive ,
220248 'vpc_uuid' : self .vpc_uuid }
221249
222250 if self .droplet_ids and self .tag :
@@ -239,13 +267,17 @@ def create(self, *args, **kwargs):
239267 self .id = data ['load_balancer' ]['id' ]
240268 self .ip = data ['load_balancer' ]['ip' ]
241269 self .algorithm = data ['load_balancer' ]['algorithm' ]
270+ self .size = data ['load_balancer' ]['size' ]
242271 self .health_check = HealthCheck (
243272 ** data ['load_balancer' ]['health_check' ])
244273 self .sticky_sessions = StickySessions (
245274 ** data ['load_balancer' ]['sticky_sessions' ])
246275 self .droplet_ids = data ['load_balancer' ]['droplet_ids' ]
247276 self .status = data ['load_balancer' ]['status' ]
248277 self .created_at = data ['load_balancer' ]['created_at' ]
278+ self .redirect_http_to_https = data ['load_balancer' ]['redirect_http_to_https' ]
279+ self .enable_proxy_protocol = data ['load_balancer' ]['enable_proxy_protocol' ]
280+ self .enable_backend_keepalive = data ['load_balancer' ]['enable_backend_keepalive' ]
249281 self .vpc_uuid = data ['load_balancer' ]['vpc_uuid' ]
250282
251283 return self
@@ -261,6 +293,8 @@ def save(self):
261293 'region' : self .region ['slug' ],
262294 'forwarding_rules' : forwarding_rules ,
263295 'redirect_http_to_https' : self .redirect_http_to_https ,
296+ 'enable_proxy_protocol' : self .enable_proxy_protocol ,
297+ 'enable_backend_keepalive' : self .enable_backend_keepalive ,
264298 'vpc_uuid' : self .vpc_uuid
265299 }
266300
0 commit comments