2023-09-20 03:05:44 +02:00
|
|
|
package messages
|
|
|
|
|
|
|
|
import "encoding/json"
|
|
|
|
|
|
|
|
type CreateSSHKeyRequest struct {
|
|
|
|
Name string
|
|
|
|
}
|
|
|
|
|
|
|
|
type CreateSSHKeyResponse struct {
|
|
|
|
Digest string
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetSSHKeysRequest struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetSSHKeysResponse struct {
|
|
|
|
Keys []string
|
|
|
|
}
|
|
|
|
|
2024-06-02 23:18:37 +02:00
|
|
|
type ImportSSHKeyRequest struct {
|
|
|
|
Key string
|
|
|
|
Name string
|
|
|
|
}
|
|
|
|
|
|
|
|
type ImportSSHKeyResponse struct {
|
|
|
|
Success bool
|
|
|
|
ErrorMsg string
|
|
|
|
}
|
|
|
|
|
2023-09-20 03:05:44 +02:00
|
|
|
func init() {
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req CreateSSHKeyRequest
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, CreateSSHKeyRequest{})
|
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req CreateSSHKeyResponse
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, CreateSSHKeyResponse{})
|
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req GetSSHKeysRequest
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, GetSSHKeysRequest{})
|
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req GetSSHKeysResponse
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, GetSSHKeysResponse{})
|
2024-06-02 23:18:37 +02:00
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req ImportSSHKeyRequest
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, ImportSSHKeyRequest{})
|
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req ImportSSHKeyResponse
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, ImportSSHKeyResponse{})
|
2023-09-20 03:05:44 +02:00
|
|
|
}
|