rhsm: move FactsImageOptions to the rhsm/facts package
Move the FactsImageOptions from distro to the new rhsm/facts package. At the same time define the values we use as an enum, including the "test-manifest" value. Though the values don't really matter, the test value is defined first so it takes the 0 value, which feels nicer conceptually. The field in the distro.ImageOptions is changed to be a pointer to allow for nil values.
This commit is contained in:
parent
f1557fc4e4
commit
ffa1e1df17
10 changed files with 50 additions and 21 deletions
29
internal/rhsm/facts/facts.go
Normal file
29
internal/rhsm/facts/facts.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package facts
|
||||
|
||||
import "fmt"
|
||||
|
||||
type APIType uint64
|
||||
|
||||
func (at APIType) String() string {
|
||||
switch at {
|
||||
case TEST_APITYPE:
|
||||
return "test-manifest"
|
||||
case CLOUDV2_APITYPE:
|
||||
return "cloudapi-v2"
|
||||
case WELDR_APITYPE:
|
||||
return "weldr"
|
||||
}
|
||||
panic(fmt.Sprintf("invalid APIType value %d", at))
|
||||
}
|
||||
|
||||
const (
|
||||
TEST_APITYPE APIType = iota
|
||||
CLOUDV2_APITYPE
|
||||
WELDR_APITYPE
|
||||
)
|
||||
|
||||
// The ImageOptions specify things to be stored into the Insights facts
|
||||
// storage. This mostly relates to how the build of the image was performed.
|
||||
type ImageOptions struct {
|
||||
APIType APIType
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue