Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
move the generic helper func to cloudstack file
Browse files Browse the repository at this point in the history
  • Loading branch information
nettoclaudio authored and psycofdj committed Jan 22, 2021
1 parent 96c5f36 commit e5fac46
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
9 changes: 0 additions & 9 deletions cloudstack/ResourcetagsService.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,10 @@ import (
"encoding/json"
"fmt"
"net/url"
"sort"
"strconv"
"strings"
)

func getSortedKeysFromMap(m map[string]string) (keys []string) {
for k := range m {
keys = append(keys, k)
}
sort.Strings(keys)
return
}

type CreateTagsParams struct {
p map[string]interface{}
}
Expand Down
9 changes: 9 additions & 0 deletions cloudstack/cloudstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,15 @@ func getSortedKeysFromMap(m map[string]string) (keys []string) {
return keys
}

// getSortedKeysFromMap returns the keys from m in increasing order.
func getSortedKeysFromMap(m map[string]string) (keys []string) {
for k := range m {
keys = append(keys, k)
}
sort.Strings(keys)
return
}

// WithAsyncTimeout takes a custom timeout to be used by the CloudStackClient
func WithAsyncTimeout(timeout int64) ClientOption {
return func(cs *CloudStackClient) {
Expand Down
9 changes: 0 additions & 9 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -844,15 +844,6 @@ func (s *service) GenerateCode() ([]byte, error) {
pn(" return json.Unmarshal(resp, result)")
pn("}")
}
if s.name == "ResourcetagsService" {
pn("func getSortedKeysFromMap(m map[string]string) (keys []string) {")
pn(" for k := range m {")
pn(" keys = append(keys, k)")
pn(" }")
pn(" sort.Strings(keys)")
pn(" return")
pn("}")
}

for _, a := range s.apis {
s.generateParamType(a)
Expand Down

0 comments on commit e5fac46

Please sign in to comment.