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
13
vendor/github.com/JamesClonk/vultr/lib/sshkeys.go
generated
vendored
13
vendor/github.com/JamesClonk/vultr/lib/sshkeys.go
generated
vendored
|
@ -1,6 +1,10 @@
|
|||
package lib
|
||||
|
||||
import "net/url"
|
||||
import (
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// SSHKey on Vultr account
|
||||
type SSHKey struct {
|
||||
|
@ -10,6 +14,12 @@ type SSHKey struct {
|
|||
Created string `json:"date_created"`
|
||||
}
|
||||
|
||||
type sshkeys []SSHKey
|
||||
|
||||
func (s sshkeys) Len() int { return len(s) }
|
||||
func (s sshkeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
func (s sshkeys) Less(i, j int) bool { return strings.ToLower(s[i].Name) < strings.ToLower(s[j].Name) }
|
||||
|
||||
// GetSSHKeys returns a list of SSHKeys from Vultr account
|
||||
func (c *Client) GetSSHKeys() (keys []SSHKey, err error) {
|
||||
var keyMap map[string]SSHKey
|
||||
|
@ -20,6 +30,7 @@ func (c *Client) GetSSHKeys() (keys []SSHKey, err error) {
|
|||
for _, key := range keyMap {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
sort.Sort(sshkeys(keys))
|
||||
return keys, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue