Enhanced support for associating NICs with Load Balancers#1101
Conversation
|
Can one of the admins verify this patch? |
| } | ||
| } | ||
|
|
||
| return null; |
There was a problem hiding this comment.
We should return this here right? otherwise null ptr exception while running the next stage wither?
same with withExistingLoadBalancerInboundNatRule as well.
There was a problem hiding this comment.
null is returned because the user cannot proceed here - the user is pointing at a Backend that does not exist, so the logic should fail fast here.
There was a problem hiding this comment.
...so to make their error checking robust, the user code should fist ensure that the backend exists:
if (!lb.backends().contains(backendName)) {
// Missing backend
} else {
// Call the code in question
}There was a problem hiding this comment.
ah ok. I do have similar situation in VMSS, there i just throw ArgumentException with a message so that user knows whats wrong, returning null seems fine.
There was a problem hiding this comment.
the reason I figured returning null would be ok in scenarios involving the passing of a child's name as an argument is because it seems equivalent to trying to access LoadBalancer.backends().get(backendName) and similar child access scenarios, where children are returned as a Map. The Map doesn't throw in the case of a bad name.
remerging - for some reason it's still showing up as open...
Backend: simple usage to associate an existing NIC (primary IP config) with an existing LB backend:
same idea for NIC definition.
NAT rule: