hetzner-cloud-php-sdk icon indicating copy to clipboard operation
hetzner-cloud-php-sdk copied to clipboard

LoadBalancer handling overly complex

Open cztk opened this issue 2 years ago • 0 comments

This can't be meant how it's to be used is it?

$lb = $hetznerClient->loadBalancers()->getByName('...');
foreach($lb->targets as $target) {
    $ip = new LoadBalancerTargetIp($target->ip->ip);
    $lb->removeTarget('ip', $ip);
}

Same for addTarget

How I expected it to work;

$lb = $hetznerClient->loadBalancers()->getByName('...');
foreach($lb->targets as $target) {
    $lb->removeTarget($target);
   # or maybe, or make it smart and work with $target only aswell
    $lb->removeTargetByIp($target->ip);
}

Also missing a removeTargets($targets);

cztk avatar Oct 04 '23 11:10 cztk