1
0
mirror of https://github.com/rancher/types.git synced 2025-04-29 02:43:21 +00:00
types/mapper/status.go

46 lines
900 B
Go
Raw Permalink Normal View History

2017-11-15 23:59:47 +00:00
package mapper
import (
"github.com/rancher/norman/types"
"github.com/rancher/types/status"
)
type Status struct {
}
func (s Status) FromInternal(data map[string]interface{}) {
status.Set(data)
}
2018-06-05 04:44:54 +00:00
func (s Status) ToInternal(data map[string]interface{}) error {
return nil
2017-11-15 23:59:47 +00:00
}
func (s Status) ModifySchema(schema *types.Schema, schemas *types.Schemas) error {
2017-12-04 23:42:18 +00:00
_, hasSpec := schema.ResourceFields["spec"]
_, hasStatus := schema.ResourceFields["status"]
if !hasSpec || !hasStatus {
return nil
}
2017-11-15 23:59:47 +00:00
schema.ResourceFields["state"] = types.Field{
2017-11-21 23:24:00 +00:00
CodeName: "State",
Type: "string",
2017-11-15 23:59:47 +00:00
}
schema.ResourceFields["transitioning"] = types.Field{
2017-11-21 23:24:00 +00:00
CodeName: "Transitioning",
Type: "enum",
2017-11-15 23:59:47 +00:00
Options: []string{
"yes",
"no",
"error",
},
}
schema.ResourceFields["transitioningMessage"] = types.Field{
2017-11-21 23:24:00 +00:00
CodeName: "TransitioningMessage",
Type: "string",
2017-11-15 23:59:47 +00:00
}
return nil
}