Skip to content

Commit

Permalink
condition/firmwareInstall: define inband instal Kind, Unmarshal, Mars…
Browse files Browse the repository at this point in the history
…hal helper methods
  • Loading branch information
joelrebel committed Jun 26, 2024
1 parent 5f1c4bb commit b957d57
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion condition/firmware_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
)

const (
FirmwareInstall Kind = "firmwareInstall"
FirmwareInstall Kind = "firmwareInstall"
FirmwareInstallInband Kind = "firmwareInstallInband"
)

// FirmwareTaskParameters are the parameters set for a firmwareInstall condition
Expand Down Expand Up @@ -40,6 +41,23 @@ type FirmwareInstallTaskParameters struct {
FirmwareSetID uuid.UUID `json:"firmware_set_id,omitempty"`
}

func (p *FirmwareInstallTaskParameters) MapStringInterfaceToStruct(m map[string]interface{}) error {
jsonData, err := json.Marshal(m)
if err != nil {
return err
}

return json.Unmarshal(jsonData, p)
}

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

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

func (p *FirmwareInstallTaskParameters) MustJSON() []byte {
byt, err := json.Marshal(p)
if err != nil {
Expand Down

0 comments on commit b957d57

Please sign in to comment.