github.com/rancher/types@v0.0.0-20220328215343-4370ff10ecd5/mapper/status.go (about) 1 package mapper 2 3 import ( 4 "github.com/rancher/norman/types" 5 "github.com/rancher/types/status" 6 ) 7 8 type Status struct { 9 } 10 11 func (s Status) FromInternal(data map[string]interface{}) { 12 status.Set(data) 13 } 14 15 func (s Status) ToInternal(data map[string]interface{}) error { 16 return nil 17 } 18 19 func (s Status) ModifySchema(schema *types.Schema, schemas *types.Schemas) error { 20 _, hasSpec := schema.ResourceFields["spec"] 21 _, hasStatus := schema.ResourceFields["status"] 22 23 if !hasSpec || !hasStatus { 24 return nil 25 } 26 27 schema.ResourceFields["state"] = types.Field{ 28 CodeName: "State", 29 Type: "string", 30 } 31 schema.ResourceFields["transitioning"] = types.Field{ 32 CodeName: "Transitioning", 33 Type: "enum", 34 Options: []string{ 35 "yes", 36 "no", 37 "error", 38 }, 39 } 40 schema.ResourceFields["transitioningMessage"] = types.Field{ 41 CodeName: "TransitioningMessage", 42 Type: "string", 43 } 44 return nil 45 }