Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lb): UpdateIP method reverse field #320

Merged
merged 1 commit into from
Feb 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions api/lb/v1/lb_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ const (
InstanceStatusError = InstanceStatus("error")
// InstanceStatusLocked is [insert doc].
InstanceStatusLocked = InstanceStatus("locked")
// InstanceStatusMigrating is [insert doc].
InstanceStatusMigrating = InstanceStatus("migrating")
)

func (enum InstanceStatus) String() string {
Expand Down Expand Up @@ -344,6 +346,8 @@ const (
LbStatusError = LbStatus("error")
// LbStatusLocked is [insert doc].
LbStatusLocked = LbStatus("locked")
// LbStatusMigrating is [insert doc].
LbStatusMigrating = LbStatus("migrating")
)

func (enum LbStatus) String() string {
Expand Down Expand Up @@ -1757,7 +1761,7 @@ type UpdateIPRequest struct {
// IPID iP address ID
IPID string `json:"-"`
// Reverse reverse DNS
Reverse *string `json:"-"`
Reverse *string `json:"reverse"`
}

// UpdateIP update IP
Expand All @@ -1769,9 +1773,6 @@ func (s *API) UpdateIP(req *UpdateIPRequest, opts ...scw.RequestOption) (*IP, er
req.Region = defaultRegion
}

query := url.Values{}
parameter.AddToQuery(query, "reverse", req.Reverse)

if fmt.Sprint(req.Region) == "" {
return nil, errors.New("field Region cannot be empty in request")
}
Expand All @@ -1783,10 +1784,14 @@ func (s *API) UpdateIP(req *UpdateIPRequest, opts ...scw.RequestOption) (*IP, er
scwReq := &scw.ScalewayRequest{
Method: "PATCH",
Path: "/lb/v1/regions/" + fmt.Sprint(req.Region) + "/ips/" + fmt.Sprint(req.IPID) + "",
Query: query,
Headers: http.Header{},
}

err = scwReq.SetBody(req)
if err != nil {
return nil, err
}

var resp IP

err = s.client.Do(scwReq, &resp, opts...)
Expand Down Expand Up @@ -2194,7 +2199,7 @@ type AddBackendServersRequest struct {
Region scw.Region `json:"-"`
// BackendID backend ID
BackendID string `json:"-"`
// ServerIP set all IPs to remove of your backend
// ServerIP set all IPs to add on your backend
ServerIP []string `json:"server_ip"`
}

Expand Down Expand Up @@ -2282,7 +2287,7 @@ type SetBackendServersRequest struct {
Region scw.Region `json:"-"`
// BackendID backend ID
BackendID string `json:"-"`
// ServerIP set all IPs to add of your backend and remove all other
// ServerIP set all IPs to add on your backend and remove all other
ServerIP []string `json:"server_ip"`
}

Expand Down