forked from mindjiver/gopherstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathssh.go
More file actions
47 lines (42 loc) · 1.17 KB
/
ssh.go
File metadata and controls
47 lines (42 loc) · 1.17 KB
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
37
38
39
40
41
42
43
44
45
46
47
package gopherstack
import (
"net/url"
)
// Create a SSH key pair
func (c CloudstackClient) CreateSSHKeyPair(name string) (CreateSshKeyPairResponse, error) {
var resp CreateSshKeyPairResponse
params := url.Values{}
params.Set("name", name)
response, err := NewRequest(c, "createSSHKeyPair", params)
if err != nil {
return resp, err
}
resp = response.(CreateSshKeyPairResponse)
return resp, nil
}
// Deletes an SSH key pair
func (c CloudstackClient) DeleteSSHKeyPair(name string) (DeleteSshKeyPairResponse, error) {
var resp DeleteSshKeyPairResponse
params := url.Values{}
params.Set("name", name)
response, err := NewRequest(c, "deleteSSHKeyPair", params)
if err != nil {
return resp, err
}
resp = response.(DeleteSshKeyPairResponse)
return resp, err
}
type CreateSshKeyPairResponse struct {
Createsshkeypairresponse struct {
Keypair struct {
Fingerprint string `json:"fingerprint"`
Name string `json:"name"`
Privatekey string `json:"privatekey"`
} `json:"keypair"`
} `json:"createsshkeypairresponse"`
}
type DeleteSshKeyPairResponse struct {
Deletesshkeypairresponse struct {
Success string `json:"success"`
} `json:"deletesshkeypairresponse"`
}