mirror of
https://github.com/rancher/types.git
synced 2025-07-05 09:46:13 +00:00
Add preference type
This commit is contained in:
parent
10f3eab5de
commit
fa817f5f21
@ -27,7 +27,8 @@ var (
|
||||
Init(catalogTypes).
|
||||
Init(authnTypes).
|
||||
Init(schemaTypes).
|
||||
Init(stackTypes)
|
||||
Init(stackTypes).
|
||||
Init(userTypes)
|
||||
)
|
||||
|
||||
func schemaTypes(schemas *types.Schemas) *types.Schemas {
|
||||
@ -232,3 +233,18 @@ func stackTypes(schema *types.Schemas) *types.Schemas {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func userTypes(schema *types.Schemas) *types.Schemas {
|
||||
return schema.
|
||||
AddMapperForType(&Version, v3.Preference{}).
|
||||
MustImportAndCustomize(&Version, v3.Preference{}, func(schema *types.Schema) {
|
||||
schema.MustCustomizeField("name", func(f types.Field) types.Field {
|
||||
f.Required = true
|
||||
return f
|
||||
})
|
||||
schema.MustCustomizeField("namespaceId", func(f types.Field) types.Field {
|
||||
f.Required = false
|
||||
return f
|
||||
})
|
||||
})
|
||||
}
|
||||
|
15
apis/management.cattle.io/v3/user_types.go
Normal file
15
apis/management.cattle.io/v3/user_types.go
Normal file
@ -0,0 +1,15 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/rancher/norman/types"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type Preference struct {
|
||||
types.Namespaced
|
||||
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Value string `json:"value" norman:"required"`
|
||||
}
|
Loading…
Reference in New Issue
Block a user