Merge v1.2.1-master
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
a590155b0b
commit
aeb17182b4
396 changed files with 27271 additions and 9969 deletions
11
vendor/github.com/JamesClonk/vultr/lib/scripts.go
generated
vendored
11
vendor/github.com/JamesClonk/vultr/lib/scripts.go
generated
vendored
|
@ -4,6 +4,8 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// StartupScript on Vultr account
|
||||
|
@ -14,6 +16,14 @@ type StartupScript struct {
|
|||
Content string `json:"script"`
|
||||
}
|
||||
|
||||
type startupscripts []StartupScript
|
||||
|
||||
func (s startupscripts) Len() int { return len(s) }
|
||||
func (s startupscripts) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
func (s startupscripts) Less(i, j int) bool {
|
||||
return strings.ToLower(s[i].Name) < strings.ToLower(s[j].Name)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements json.Unmarshaller on StartupScript.
|
||||
// Necessary because the SCRIPTID field has inconsistent types.
|
||||
func (s *StartupScript) UnmarshalJSON(data []byte) (err error) {
|
||||
|
@ -47,6 +57,7 @@ func (c *Client) GetStartupScripts() (scripts []StartupScript, err error) {
|
|||
}
|
||||
scripts = append(scripts, script)
|
||||
}
|
||||
sort.Sort(startupscripts(scripts))
|
||||
return scripts, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue