1
0
mirror of https://github.com/rancher/types.git synced 2025-09-17 07:19:17 +00:00

credential type

This commit is contained in:
kinarashah
2018-12-07 11:43:28 -08:00
committed by Alena Prokharchyk
parent 129266c375
commit b5f3a23193
3 changed files with 105 additions and 5 deletions

View File

@@ -40,10 +40,11 @@ type NodeTemplateCondition struct {
}
type NodeTemplateSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
Driver string `json:"driver" norman:"nocreate,noupdate"`
NodeCommonParams `json:",inline"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
Driver string `json:"driver" norman:"nocreate,noupdate"`
CloudCredentialName string `json:"cloudCredentialName" norman:"type=reference[cloudCredential]"`
NodeCommonParams `json:",inline"`
}
type Node struct {
@@ -292,3 +293,11 @@ type NodeDrainInput struct {
// Time to wait (in seconds) before giving up for one try
Timeout int `json:"timeout" norman:"min=1,max=10800,default=60"`
}
type CloudCredential struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
}

View File

@@ -40,7 +40,9 @@ var (
Init(globalDNSTypes).
Init(kontainerTypes).
Init(etcdBackupTypes).
Init(monitorTypes)
Init(monitorTypes).
Init(credTypes).
Init(mgmtSecretTypes)
TokenSchemas = factory.Schemas(&Version).
Init(tokens)
@@ -55,6 +57,24 @@ func schemaTypes(schemas *types.Schemas) *types.Schemas {
MustImport(&Version, v3.DynamicSchema{})
}
func credTypes(schemas *types.Schemas) *types.Schemas {
return schemas.
AddMapperForType(&Version, v3.CloudCredential{},
&mapper.CredentialMapper{},
&m.Move{From: "name", To: "id"},
&m.Drop{Field: "namespaceId"}).
MustImport(&Version, v3.CloudCredential{})
}
func mgmtSecretTypes(schemas *types.Schemas) *types.Schemas {
return schemas.MustImportAndCustomize(&Version, v1.Secret{}, func(schema *types.Schema) {
schema.ID = "managementSecret"
schema.PluralName = "managementSecrets"
schema.CodeName = "ManagementSecret"
schema.CodeNamePlural = "ManagementSecrets"
})
}
func catalogTypes(schemas *types.Schemas) *types.Schemas {
return schemas.
AddMapperForType(&Version, v3.Catalog{},