Skip to content

Commit

Permalink
Remove error from return value of ToLoadBalancerActionMap
Browse files Browse the repository at this point in the history
  • Loading branch information
hico-horiuchi committed May 16, 2024
1 parent 7487058 commit 4a4af37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
13 changes: 4 additions & 9 deletions v2/ecl/managed_load_balancer/v1/load_balancers/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ type ActionOpts struct {
}

// ToLoadBalancerActionMap builds a request body from ActionOpts.
func (opts ActionOpts) ToLoadBalancerActionMap() (map[string]interface{}, error) {
func (opts ActionOpts) ToLoadBalancerActionMap() map[string]interface{} {
optsMap := make(map[string]interface{})

if opts.ApplyConfigurations {
Expand All @@ -330,22 +330,17 @@ func (opts ActionOpts) ToLoadBalancerActionMap() (map[string]interface{}, error)
}
}

return optsMap, nil
return optsMap
}

// ActionOptsBuilder allows extensions to add additional parameters to the Action request.
type ActionOptsBuilder interface {
ToLoadBalancerActionMap() (map[string]interface{}, error)
ToLoadBalancerActionMap() map[string]interface{}
}

// Action accepts a ActionOpts struct and performs action on a existing load balancer using the values provided.
func Action(c *eclcloud.ServiceClient, id string, opts ActionOptsBuilder) (r ActionResult) {
b, err := opts.ToLoadBalancerActionMap()
if err != nil {
r.Err = err

return
}
b := opts.ToLoadBalancerActionMap()

_, r.Err = c.Post(actionURL(c, id), b, nil, &eclcloud.RequestOpts{
OkCodes: []int{204},
Expand Down
13 changes: 4 additions & 9 deletions v3/ecl/managed_load_balancer/v1/load_balancers/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ type ActionOpts struct {
}

// ToLoadBalancerActionMap builds a request body from ActionOpts.
func (opts ActionOpts) ToLoadBalancerActionMap() (map[string]interface{}, error) {
func (opts ActionOpts) ToLoadBalancerActionMap() map[string]interface{} {
optsMap := make(map[string]interface{})

if opts.ApplyConfigurations {
Expand All @@ -330,22 +330,17 @@ func (opts ActionOpts) ToLoadBalancerActionMap() (map[string]interface{}, error)
}
}

return optsMap, nil
return optsMap
}

// ActionOptsBuilder allows extensions to add additional parameters to the Action request.
type ActionOptsBuilder interface {
ToLoadBalancerActionMap() (map[string]interface{}, error)
ToLoadBalancerActionMap() map[string]interface{}
}

// Action accepts a ActionOpts struct and performs action on a existing load balancer using the values provided.
func Action(c *eclcloud.ServiceClient, id string, opts ActionOptsBuilder) (r ActionResult) {
b, err := opts.ToLoadBalancerActionMap()
if err != nil {
r.Err = err

return
}
b := opts.ToLoadBalancerActionMap()

_, r.Err = c.Post(actionURL(c, id), b, nil, &eclcloud.RequestOpts{
OkCodes: []int{204},
Expand Down

0 comments on commit 4a4af37

Please sign in to comment.