Skip to content

Commit

Permalink
[fix] nil in to map
Browse files Browse the repository at this point in the history
  • Loading branch information
cuongpiger committed Oct 27, 2024
1 parent 967fa54 commit ae26495
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion vngcloud/services/loadbalancer/v2/loadbalancer_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type ResizeLoadBalancerByIdRequest struct {
}

func (s *CreateLoadBalancerRequest) ToMap() map[string]interface{} {
return map[string]interface{}{
err := map[string]interface{}{
"name": s.Name,
"packageId": s.PackageID,
"scheme": s.Scheme,
Expand All @@ -75,6 +75,16 @@ func (s *CreateLoadBalancerRequest) ToMap() map[string]interface{} {
"pool": s.Pool.ToMap(),
"tags": s.Tags,
}

if s.Listener != nil {
err["listener"] = s.Listener.ToMap()
}

if s.Pool != nil {
err["pool"] = s.Pool.ToMap()
}

return err
}

func (s *CreateLoadBalancerRequest) ToRequestBody() interface{} {
Expand Down

0 comments on commit ae26495

Please sign in to comment.