-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathssh_keys.go
More file actions
36 lines (30 loc) · 787 Bytes
/
Copy pathssh_keys.go
File metadata and controls
36 lines (30 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package atlanticnet
type SshKey struct {
Id string `json:"key_id"`
Name string `json:"key_name"`
PublicKey string `json:"public_key"`
}
type listSshKeysResponse struct {
KeysSet map[string]SshKey `json:"KeysSet"`
RequestId string `json:"requestid"`
}
type listSshKeysDTO struct {
BaseResponse
Response listSshKeysResponse `json:"list-sshkeysresponse"`
}
func (c *client) ListSshKeys() ([]SshKey, error) {
out := listSshKeysDTO{}
err := c.doRequest("list-sshkeys", nil, &out)
if err != nil {
return []SshKey{}, err
} else if out.Error != nil {
return []SshKey{}, out.Error
}
sshKeys := make([]SshKey, len(out.Response.KeysSet))
i := 0
for _, sshKey := range out.Response.KeysSet {
sshKeys[i] = sshKey
i += 1
}
return sshKeys, nil
}