Skip to content

Commit 5556ecb

Browse files
authored
Fix Load Balancer Client (#93)
1 parent 6908111 commit 5556ecb

File tree

6 files changed

+516
-228
lines changed

6 files changed

+516
-228
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ History
55
master (XXXX-XX-XX)
66
--------------------
77

8+
* Breaking Change: The LoadBalancerClient create methods returned only the created Load Balancer instead of the Load Balancer and the create Action.
89
* Fix: Unify setting of request parameters within `get_list` methods.
910

1011
1.8.0 (2020-06-22)

hcloud/load_balancers/client.py

Lines changed: 132 additions & 117 deletions
Large diffs are not rendered by default.

hcloud/load_balancers/domain.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,25 @@ def __init__(self,
281281
):
282282
self.network = network
283283
self.ip = ip
284+
285+
286+
class CreateLoadBalancerResponse(BaseDomain):
287+
"""Create Load Balancer Response Domain
288+
289+
:param load_balancer: :class:`BoundLoadBalancer <hcloud.load_balancers.client.BoundLoadBalancer>`
290+
The created Load Balancer
291+
:param action: :class:`BoundAction <hcloud.actions.client.BoundAction>`
292+
Shows the progress of the Load Balancer creation
293+
"""
294+
__slots__ = (
295+
"load_balancer",
296+
"action",
297+
)
298+
299+
def __init__(
300+
self,
301+
load_balancer, # type: BoundLoadBalancer
302+
action, # type: BoundAction
303+
):
304+
self.load_balancer = load_balancer
305+
self.action = action

tests/integration/load_balancers/test_load_balancers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ def test_get_list(self, hetzner_client):
3737
assert load_balancers[0].id == 4711
3838

3939
def test_create(self, hetzner_client):
40-
load_balancer = hetzner_client.load_balancers.create(
40+
resp = hetzner_client.load_balancers.create(
4141
"Web Frontend",
4242
load_balancer_type=LoadBalancerType(name="lb1"),
4343
algorithm=LoadBalancerAlgorithm("round_robin"))
44-
44+
load_balancer = resp.load_balancer
4545
assert load_balancer.id == 4711
4646
assert load_balancer.name == "Web Frontend"
4747

0 commit comments

Comments
 (0)