Skip to content

Commit

Permalink
Add marshal/unmarshal (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeschuurmans committed Aug 7, 2024
1 parent cdf0421 commit 03c2cee
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion condition/server_control.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package condition

import "github.com/google/uuid"
import (
"encoding/json"

"github.com/google/uuid"
)

type (
ServerControlAction string
Expand Down Expand Up @@ -74,6 +78,14 @@ type ServerControlTaskParameters struct {
SetNextBootDeviceEFI bool `json:"set_next_boot_device_efi"`
}

func (p *ServerControlTaskParameters) Unmarshal(r json.RawMessage) error {
return json.Unmarshal(r, p)
}

func (p *ServerControlTaskParameters) Marshal() (json.RawMessage, error) {
return json.Marshal(p)
}

func NewServerControlTaskParameters(assetID uuid.UUID, action ServerControlAction, controlParam string, bootDevicePersistent, efiBoot bool) *ServerControlTaskParameters {
return &ServerControlTaskParameters{
AssetID: assetID,
Expand Down

0 comments on commit 03c2cee

Please sign in to comment.