Skip to content

Commit

Permalink
condition: Add biosControl condition
Browse files Browse the repository at this point in the history
Add the basic biosControl condition kind with task parameters struct
and functions.
  • Loading branch information
coffeefreak101 committed Apr 19, 2024
1 parent 2ba0f73 commit f6074af
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions condition/bios_control.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package condition

import (
"encoding/json"

"github.com/google/uuid"
)

type (
BiosControlAction string
)

const (
// BiosControl identifies the Condition kind to configure the BIOS.
BiosControl Kind = "biosControl"

// ResetSettings will reset the BIOS to default settings.
ResetSettings BiosControlAction = "reset_settings"
)

// BiosControlTaskParameters are the parameters that are passed for the BiosControl condition.
type BiosControlTaskParameters struct {
// Identifier for the Asset in the Asset store.
//
// Required: true
AssetID uuid.UUID `json:"asset_id"`

// The bios control action to be performed
//
// Required: true
Action BiosControlAction `json:"action"`
}

func NewBiosControlTaskParameters(assetID uuid.UUID, action BiosControlAction) *BiosControlTaskParameters {
return &BiosControlTaskParameters{
AssetID: assetID,
Action: action,
}
}

func NewBiosControlParametersFromCondition(condition *Condition) (*BiosControlTaskParameters, error) {
b := &BiosControlTaskParameters{}
err := json.Unmarshal(condition.Parameters, b)

return b, err
}

0 comments on commit f6074af

Please sign in to comment.