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
Latest commit
47 lines (42 loc) · 1.17 KB
/
Copy pathssh.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 (cCloudstackClient) CreateSSHKeyPair(namestring) (CreateSshKeyPairResponse, error) {
varrespCreateSshKeyPairResponse
params:= url.Values{}
params.Set("name", name)
response, err:=NewRequest(c, "createSSHKeyPair", params)
iferr!=nil {
returnresp, err
}
resp=response.(CreateSshKeyPairResponse)
returnresp, nil
}
// Deletes an SSH key pair
func (cCloudstackClient) DeleteSSHKeyPair(namestring) (DeleteSshKeyPairResponse, error) {
varrespDeleteSshKeyPairResponse
params:= url.Values{}
params.Set("name", name)
response, err:=NewRequest(c, "deleteSSHKeyPair", params)
iferr!=nil {
returnresp, err
}
resp=response.(DeleteSshKeyPairResponse)
returnresp, err
}
typeCreateSshKeyPairResponsestruct {
Createsshkeypairresponsestruct {
Keypairstruct {
Fingerprintstring`json:"fingerprint"`
Namestring`json:"name"`
Privatekeystring`json:"privatekey"`
} `json:"keypair"`
} `json:"createsshkeypairresponse"`
}
typeDeleteSshKeyPairResponsestruct {
Deletesshkeypairresponsestruct {
Successstring`json:"success"`
} `json:"deletesshkeypairresponse"`
}