mirror of
https://github.com/rancher/types.git
synced 2025-09-16 23:08:25 +00:00
Updates type for subcontext rewrite
This commit is contained in:
@@ -12,9 +12,11 @@ import (
|
||||
|
||||
var (
|
||||
Version = types.APIVersion{
|
||||
Version: "v3",
|
||||
Group: "cluster.cattle.io",
|
||||
Path: "/v3/clusters",
|
||||
Version: "v3",
|
||||
Group: "cluster.cattle.io",
|
||||
Path: "/v3/cluster",
|
||||
SubContext: true,
|
||||
SubContextSchema: "/v3/schemas/cluster",
|
||||
}
|
||||
|
||||
Schemas = factory.Schemas(&Version).
|
||||
|
@@ -16,9 +16,6 @@ var (
|
||||
Version: "v3",
|
||||
Group: "management.cattle.io",
|
||||
Path: "/v3",
|
||||
SubContexts: map[string]bool{
|
||||
"clusters": true,
|
||||
},
|
||||
}
|
||||
|
||||
Schemas = factory.Schemas(&Version).
|
||||
@@ -30,7 +27,6 @@ var (
|
||||
Init(authnTypes).
|
||||
Init(tokens).
|
||||
Init(schemaTypes).
|
||||
Init(stackTypes).
|
||||
Init(userTypes).
|
||||
Init(logTypes).
|
||||
Init(globalTypes).
|
||||
@@ -84,9 +80,7 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
|
||||
AddMapperForType(&Version, v3.RancherKubernetesEngineConfig{},
|
||||
m.Drop{Field: "systemImages"},
|
||||
).
|
||||
MustImportAndCustomize(&Version, v3.Cluster{}, func(schema *types.Schema) {
|
||||
schema.SubContext = "clusters"
|
||||
}).
|
||||
MustImport(&Version, v3.Cluster{}).
|
||||
MustImport(&Version, v3.ClusterEvent{}).
|
||||
MustImport(&Version, v3.ClusterRegistrationToken{}).
|
||||
MustImportAndCustomize(&Version, v3.Cluster{}, func(schema *types.Schema) {
|
||||
@@ -109,9 +103,7 @@ func authzTypes(schemas *types.Schemas) *types.Schemas {
|
||||
AddMapperForType(&Version, v3.ProjectRoleTemplateBinding{},
|
||||
&mapper.NamespaceIDMapper{},
|
||||
).
|
||||
MustImportAndCustomize(&Version, v3.Project{}, func(schema *types.Schema) {
|
||||
schema.SubContext = "projects"
|
||||
}).
|
||||
MustImport(&Version, v3.Project{}).
|
||||
MustImport(&Version, v3.GlobalRole{}).
|
||||
MustImport(&Version, v3.GlobalRoleBinding{}).
|
||||
MustImport(&Version, v3.RoleTemplate{}).
|
||||
@@ -218,20 +210,6 @@ func authnTypes(schemas *types.Schemas) *types.Schemas {
|
||||
})
|
||||
}
|
||||
|
||||
func stackTypes(schema *types.Schemas) *types.Schemas {
|
||||
return schema.
|
||||
MustImportAndCustomize(&Version, v3.App{}, func(schema *types.Schema) {
|
||||
schema.ResourceActions = map[string]types.Action{
|
||||
"upgrade": {
|
||||
Input: "templateVersionId",
|
||||
},
|
||||
"rollback": {
|
||||
Input: "revision",
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func userTypes(schema *types.Schemas) *types.Schemas {
|
||||
return schema.
|
||||
MustImportAndCustomize(&Version, v3.Preference{}, func(schema *types.Schema) {
|
||||
|
@@ -13,17 +13,15 @@ import (
|
||||
|
||||
var (
|
||||
Version = types.APIVersion{
|
||||
Version: "v3",
|
||||
Group: "project.cattle.io",
|
||||
Path: "/v3/projects",
|
||||
SubContexts: map[string]bool{
|
||||
"projects": true,
|
||||
},
|
||||
Version: "v3",
|
||||
Group: "project.cattle.io",
|
||||
Path: "/v3/project",
|
||||
SubContext: true,
|
||||
SubContextSchema: "/v3/schemas/project",
|
||||
}
|
||||
|
||||
Schemas = factory.Schemas(&Version).
|
||||
// Namespace must be first
|
||||
Init(namespaceTypes).
|
||||
// volume before pod types. pod types uses volume things, so need to register mapper
|
||||
Init(volumeTypes).
|
||||
Init(ingressTypes).
|
||||
@@ -36,6 +34,7 @@ var (
|
||||
Init(replicationController).
|
||||
Init(daemonSet).
|
||||
Init(workloadTypes).
|
||||
Init(appTypes).
|
||||
Init(configMapTypes)
|
||||
)
|
||||
|
||||
@@ -454,3 +453,17 @@ func volumeTypes(schemas *types.Schemas) *types.Schemas {
|
||||
return schemas.
|
||||
MustImport(&Version, v1.PersistentVolumeClaim{}, projectOverride{})
|
||||
}
|
||||
|
||||
func appTypes(schema *types.Schemas) *types.Schemas {
|
||||
return schema.
|
||||
MustImportAndCustomize(&Version, v3.App{}, func(schema *types.Schema) {
|
||||
schema.ResourceActions = map[string]types.Action{
|
||||
"upgrade": {
|
||||
Input: "templateVersionId",
|
||||
},
|
||||
"rollback": {
|
||||
Input: "revision",
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user