From f996afe0b3a3d4e0fd94ef93d6caa2d098996c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bourgois?= Date: Tue, 10 Dec 2019 13:33:04 +0100 Subject: [PATCH 1/3] fix: properly convert ipId to ip-id --- strcase/bash_arg.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strcase/bash_arg.go b/strcase/bash_arg.go index e12874896..89ceeb59e 100644 --- a/strcase/bash_arg.go +++ b/strcase/bash_arg.go @@ -3,13 +3,13 @@ package strcase import "strings" var customBashNames = map[string]string{ - "IPID": "ip-id", + "ipid": "ip-id", } // ToBashArg returns the Bash public name of the given string. func ToBashArg(s string) string { s = ToPublicGoName(s) - if customBashName, exists := customBashNames[s]; exists { + if customBashName, exists := customBashNames[strings.ToLower(s)]; exists { return customBashName } for _, initialism := range customInitialisms { From d1c3f5c30367ae8d168e4bb870e6e6126a81f53d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bourgois?= Date: Tue, 10 Dec 2019 13:51:24 +0100 Subject: [PATCH 2/3] fix --- api/instance/v1/instance_sdk.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/instance/v1/instance_sdk.go b/api/instance/v1/instance_sdk.go index a284646db..2acc9a002 100644 --- a/api/instance/v1/instance_sdk.go +++ b/api/instance/v1/instance_sdk.go @@ -4054,8 +4054,8 @@ func (s *API) updateIP(req *updateIPRequest, opts ...scw.RequestOption) (*Update type DeleteIPRequest struct { Zone scw.Zone `json:"-"` - - IPID string `json:"-"` + // IP the ID or the address of the IP to delete + IP string `json:"-"` } // DeleteIP delete IP @@ -4073,13 +4073,13 @@ func (s *API) DeleteIP(req *DeleteIPRequest, opts ...scw.RequestOption) error { return errors.New("field Zone cannot be empty in request") } - if fmt.Sprint(req.IPID) == "" { - return errors.New("field IPID cannot be empty in request") + if fmt.Sprint(req.IP) == "" { + return errors.New("field IP cannot be empty in request") } scwReq := &scw.ScalewayRequest{ Method: "DELETE", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/ips/" + fmt.Sprint(req.IPID) + "", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/ips/" + fmt.Sprint(req.IP) + "", Headers: http.Header{}, } From 07d98381713d31f11e751da8058484274d80ffbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bourgois?= Date: Tue, 10 Dec 2019 14:00:08 +0100 Subject: [PATCH 3/3] fix --- api/instance/v1/instance_utils_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/instance/v1/instance_utils_test.go b/api/instance/v1/instance_utils_test.go index 4eb5d2e57..a5b575dc2 100644 --- a/api/instance/v1/instance_utils_test.go +++ b/api/instance/v1/instance_utils_test.go @@ -102,7 +102,7 @@ func TestInstanceHelpers(t *testing.T) { // Delete IP err = instanceAPI.DeleteIP(&DeleteIPRequest{ Zone: zone, - IPID: ipID, + IP: ipID, }) testhelpers.AssertNoError(t, err)