Skip to content

Commit

Permalink
ipgroup update (#569)
Browse files Browse the repository at this point in the history
[ELB] ipgroup update fix

https://docs.otc.t-systems.com/elastic-load-balancing/api-ref/apis_v3/listener/updating_a_listener.html#updatelistener-request-updatelisteneripgroupoption
Seems now we can disable ipgroup
What this PR does / why we need it
Which issue this PR fixes

Special notes for your reviewer

Reviewed-by: Artem Lifshits
Reviewed-by: Vladimir Vshivkov
Reviewed-by: Aloento
  • Loading branch information
anton-sidelnikov committed Aug 23, 2023
1 parent bc6e3b1 commit e936ed9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
19 changes: 17 additions & 2 deletions acceptance/openstack/elb/v3/ipgroups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func TestIpGroupsLifecycle(t *testing.T) {
th.AssertNoErr(t, err)

loadbalancerID := createLoadBalancer(t, client)
defer deleteLoadbalancer(t, client, loadbalancerID)

ipGroupOpts := ipgroups.IpGroupOption{
Ip: "192.168.10.10",
Expand Down Expand Up @@ -92,8 +91,24 @@ func TestIpGroupsLifecycle(t *testing.T) {
},
}).Extract()
th.AssertNoErr(t, err)
defer deleteListener(t, client, listener.ID)
th.AssertEquals(t, *listener.IpGroup.Enable, true)

t.Logf("Attempting to create ELBv3 Listener with ipGroup association")
listenerUpdated, err := listeners.Update(client, listener.ID, listeners.UpdateOpts{
IpGroup: &listeners.IpGroupUpdate{
IpGroupId: ipGroup.ID,
Enable: pointerto.Bool(false),
},
}).Extract()
th.AssertNoErr(t, err)
th.AssertEquals(t, *listenerUpdated.IpGroup.Enable, false)

t.Cleanup(func() {
t.Logf("Attempting to delete ELBv3 Listener and Loadbalancer: %s", listener.ID)
deleteListener(t, client, listener.ID)
deleteLoadbalancer(t, client, loadbalancerID)
t.Logf("Deleted ELBv3 Listener: %s, Deleted ELBv3 Loadbalancer: %s", listener.ID, loadbalancerID)
})
updatedIpList, err := ipgroups.UpdateIpList(client, ipGroup.ID, ipgroups.UpdateOpts{
IpList: []ipgroups.IpGroupOption{
{
Expand Down
1 change: 1 addition & 0 deletions openstack/elb/v3/listeners/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ type UpdateOptsBuilder interface {

type IpGroupUpdate struct {
IpGroupId string `json:"ipgroup_id,omitempty"`
Enable *bool `json:"enable_ipgroup,omitempty"`
Type string `json:"type,omitempty"`
}

Expand Down

0 comments on commit e936ed9

Please sign in to comment.