diff --git a/condition/types.go b/condition/types.go index 2c618d3..bd6ad80 100644 --- a/condition/types.go +++ b/condition/types.go @@ -2,6 +2,7 @@ package condition import ( "encoding/json" + "fmt" "time" "github.com/google/uuid" @@ -140,6 +141,16 @@ type Condition struct { CreatedAt time.Time `json:"createdAt,omitempty"` } +func (c *Condition) StreamPublishSubject(facilityCode string) string { + // note: inband install conditions are published with the serverID in the subject suffix + if c.Kind == FirmwareInstallInband { + return fmt.Sprintf("%s.servers.%s.%s", facilityCode, c.Kind, c.Target.String()) + + } + + return fmt.Sprintf("%s.servers.%s", facilityCode, c.Kind) +} + // Fault is used to introduce faults into the controller when executing on a condition. // // Note: this depends on controllers implementing support to honor the given fault.