From 03c2cee27bc37a0586518d1f71df9fc4caa8827f Mon Sep 17 00:00:00 2001 From: Jake Schuurmans <143427381+jakeschuurmans@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:42:46 -0400 Subject: [PATCH] Add marshal/unmarshal (#83) --- condition/server_control.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/condition/server_control.go b/condition/server_control.go index 886be1c..dcae24c 100644 --- a/condition/server_control.go +++ b/condition/server_control.go @@ -1,6 +1,10 @@ package condition -import "github.com/google/uuid" +import ( + "encoding/json" + + "github.com/google/uuid" +) type ( ServerControlAction string @@ -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,