How to update only one existing portrule at LB


#1

Hi everybody.
Could you please explain me how can I update only one of 15 existing portrules at LB without changing/deleting/modifying all of them and without need to place all rules in POST in array?
Can I put in POST only one portrule and in this case only one rule will be updated and other 14 will still exist without any changes?

Thanks in advance


#2

You can’t. The array of rules is one field on the resource and you either don’t send it at all (to not change it) or provide a new complete value on PUT.


#3

Thank you Vincent
So if I will send PUT to my lb, for example, only with new -lbConfig.config field(for HAproxy) then only this field will be updated and portRules still exist w/o changes and vise versa?


#4

Was trying to update only part of lb config for HAproxy. I’ve sent this payload:

{
	"lbConfig": {
		"config": "backend 80_XXXXX_elb_us_west_2_amazonaws_com_logs_XXXX\nhttp-request set-path /logs\nbackend 80_XXXXXX_elb_us_west_2_amazonaws_com_logs_XXXXXX\nhttp - request set - path /logs"
	}
}

and in this case I’ve lost all my portrules and the HAconfig as well as . What I was doing wrong?


#5

That’s a different question then you originally asked but didn’t with for the same reason… Only the top level keys you provide are updated on put, but this doesn’t apply recursively. So to change something inside lbConfig you need to send an entire new lbConfig.