feat(LXC): add ssh-keys
This commit is contained in:
14
lxc.go
14
lxc.go
@@ -8,6 +8,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/platform-engineering-labs/formae/pkg/plugin/resource"
|
"github.com/platform-engineering-labs/formae/pkg/plugin/resource"
|
||||||
)
|
)
|
||||||
@@ -67,12 +68,13 @@ func (p *Plugin) CreateLXC(ctx context.Context, req *resource.CreateRequest) (*r
|
|||||||
}
|
}
|
||||||
|
|
||||||
urlparams := url.Values{
|
urlparams := url.Values{
|
||||||
"vmid": {props.VMID},
|
"vmid": {props.VMID},
|
||||||
"ostemplate": {props.OSTemplate},
|
"ostemplate": {props.OSTemplate},
|
||||||
"password": {props.Password},
|
"password": {props.Password},
|
||||||
"hostname": {props.Hostname},
|
"hostname": {props.Hostname},
|
||||||
"cores": {strconv.Itoa(props.Cores)},
|
"cores": {strconv.Itoa(props.Cores)},
|
||||||
"memory": {strconv.Itoa(props.Memory)},
|
"memory": {strconv.Itoa(props.Memory)},
|
||||||
|
"ssh-public-keys": {strings.Join(props.SSHKeys, "\n")},
|
||||||
}
|
}
|
||||||
if props.Description != "" {
|
if props.Description != "" {
|
||||||
urlparams.Add("description", props.Description)
|
urlparams.Add("description", props.Description)
|
||||||
|
|||||||
@@ -46,4 +46,7 @@ class LXC extends formae.Resource {
|
|||||||
@formae.FieldHint {}
|
@formae.FieldHint {}
|
||||||
onboot: Int = 0
|
onboot: Int = 0
|
||||||
|
|
||||||
|
@formae.FieldHint {}
|
||||||
|
sshkeys: Listing<String>?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
17
types.go
17
types.go
@@ -8,14 +8,15 @@ type TargetConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type LXCProperties struct {
|
type LXCProperties struct {
|
||||||
VMID string `json:"vmid"`
|
VMID string `json:"vmid"`
|
||||||
Hostname string `json:"hostname"`
|
Hostname string `json:"hostname"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
OSTemplate string `json:"ostemplate,omitempty"`
|
OSTemplate string `json:"ostemplate,omitempty"`
|
||||||
Password string `json:"password,omitempty"`
|
Password string `json:"password,omitempty"`
|
||||||
Cores int `json:"cores"`
|
Cores int `json:"cores"`
|
||||||
Memory int `json:"memory"`
|
Memory int `json:"memory"`
|
||||||
OnBoot int `json:"onboot"`
|
OnBoot int `json:"onboot"`
|
||||||
|
SSHKeys []string `json:"sshkeys"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadRequest struct {
|
type ReadRequest struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user