Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add more VM context keys #14

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cloud/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ type Context struct {
Firmware string
GuestOS string
Network bool
SSHPublicKey string
Target string
Token bool
ProjectName string
SetHostname string
SSHPublicKey string
}

// OS is the API payload based on the legacy xmlrpc backend.
Expand Down
8 changes: 8 additions & 0 deletions cloud/instance/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ func setContextValue(dst *Context, key string, value any) error {
dst.Target = v
case "PROJECT_NAME":
dst.ProjectName = v
case "SET_HOSTNAME":
dst.SetHostname = v
case "TOKEN":
b, err := api.Str2Bool(v)
if err != nil {
return fmt.Errorf("invalid TOKEN value %q: %w", v, err)
}
dst.Token = b
default:
return fmt.Errorf("unknown key: %s", key)
}
Expand Down
4 changes: 2 additions & 2 deletions cloud/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -906,9 +906,9 @@ type DeleteTemplateResponse struct {
Template int `json:"template"`
}

// InstantiateTemplateResponse is the response body for DELETE /cloud/template/{template}.
// InstantiateTemplateResponse is the response body for POST /cloud/template/{template}.
type InstantiateTemplateResponse struct {
Template int `json:"template"`
Instance int `json:"instance"`
}

// UpdateTemplateResponse is the response body for PATCH /cloud/template.
Expand Down
Loading