mirror of
https://github.com/rancher/types.git
synced 2025-05-06 14:16:18 +00:00
UserAttribute backend
This commit is contained in:
parent
aa4b48988f
commit
cd18165f8d
@ -35,6 +35,19 @@ type User struct {
|
||||
Me bool `json:"me,omitempty"`
|
||||
}
|
||||
|
||||
// UserAttribute will have a CRD (and controller) generated for it, but will not be exposed in the API.
|
||||
type UserAttribute struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
UserName string
|
||||
GroupPrincipals map[string]Principals // the value is a []Principal, but code generator cannot handle slice as a value
|
||||
}
|
||||
|
||||
type Principals struct {
|
||||
Items []Principal
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
@ -416,6 +416,10 @@ func userTypes(schema *types.Schemas) *types.Schemas {
|
||||
f.Required = false
|
||||
return f
|
||||
})
|
||||
}).
|
||||
MustImportAndCustomize(&Version, v3.UserAttribute{}, func(schema *types.Schema) {
|
||||
schema.CollectionMethods = []string{}
|
||||
schema.ResourceMethods = []string{}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -53,14 +53,14 @@ func contains(list []string, needle string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func Generate(schemas *types.Schemas) {
|
||||
func Generate(schemas *types.Schemas, backendTypes map[string]bool) {
|
||||
version := getVersion(schemas)
|
||||
group := strings.Split(version.Group, ".")[0]
|
||||
|
||||
cattleOutputPackage := path.Join(basePackage, baseCattle, group, version.Version)
|
||||
k8sOutputPackage := path.Join(basePackage, baseK8s, version.Group, version.Version)
|
||||
|
||||
if err := generator.Generate(schemas, cattleOutputPackage, k8sOutputPackage); err != nil {
|
||||
if err := generator.Generate(schemas, backendTypes, cattleOutputPackage, k8sOutputPackage); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
10
main.go
10
main.go
@ -21,10 +21,12 @@ import (
|
||||
|
||||
func main() {
|
||||
generator.GenerateComposeType(projectSchema.Schemas, managementSchema.Schemas, clusterSchema.Schemas)
|
||||
generator.Generate(managementSchema.Schemas)
|
||||
generator.Generate(publicSchema.PublicSchemas)
|
||||
generator.Generate(clusterSchema.Schemas)
|
||||
generator.Generate(projectSchema.Schemas)
|
||||
generator.Generate(managementSchema.Schemas, map[string]bool{
|
||||
"userAttribute": true},
|
||||
)
|
||||
generator.Generate(publicSchema.PublicSchemas, nil)
|
||||
generator.Generate(clusterSchema.Schemas, nil)
|
||||
generator.Generate(projectSchema.Schemas, nil)
|
||||
generator.GenerateNativeTypes(v1.SchemeGroupVersion, []interface{}{
|
||||
v1.Endpoints{},
|
||||
v1.Pod{},
|
||||
|
Loading…
Reference in New Issue
Block a user