1
0
mirror of https://github.com/rancher/types.git synced 2025-09-16 06:49:21 +00:00

cluster auth token type changes

This commit is contained in:
Erik Wilson
2018-10-25 09:56:31 -07:00
committed by Craig Jellick
parent 918e3096ba
commit 8cac937266
8 changed files with 75 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ package schema
import (
"github.com/rancher/norman/types"
m "github.com/rancher/norman/types/mapper"
"github.com/rancher/types/apis/cluster.cattle.io/v3"
"github.com/rancher/types/factory"
"k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
@@ -20,7 +21,8 @@ var (
Schemas = factory.Schemas(&Version).
Init(namespaceTypes).
Init(persistentVolumeTypes).
Init(storageClassTypes)
Init(storageClassTypes).
Init(tokens)
)
func namespaceTypes(schemas *types.Schemas) *types.Schemas {
@@ -86,3 +88,15 @@ func storageClassTypes(schemas *types.Schemas) *types.Schemas {
ReclaimPolicy string `json:"reclaimPolicy,omitempty" norman:"type=enum,options=Recycle|Delete|Retain"`
}{})
}
func tokens(schemas *types.Schemas) *types.Schemas {
return schemas.
MustImportAndCustomize(&Version, v3.ClusterAuthToken{}, func(schema *types.Schema) {
schema.CollectionMethods = []string{}
schema.ResourceMethods = []string{}
}).
MustImportAndCustomize(&Version, v3.ClusterUserAttribute{}, func(schema *types.Schema) {
schema.CollectionMethods = []string{}
schema.ResourceMethods = []string{}
})
}

View File

@@ -0,0 +1,30 @@
package v3
import (
"github.com/rancher/norman/types"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type ClusterUserAttribute struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Groups []string `json:"groups,omitempty"`
LastRefresh string `json:"lastRefresh,omitempty"`
NeedsRefresh bool `json:"needsRefresh"`
Enabled bool `json:"enabled"`
}
type ClusterAuthToken struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
UserName string `json:"userName"`
ExpiresAt string `json:"expiresAt,omitempty"`
SecretKeyHash string `json:"hash"`
Enabled bool `json:"enabled"`
}