mirror of
https://github.com/rancher/types.git
synced 2025-09-09 00:48:56 +00:00
add displayName to cloud credential and mapper changes for it
This commit is contained in:
committed by
Alena Prokharchyk
parent
e705052807
commit
86c01d27a8
@@ -319,5 +319,6 @@ type CloudCredential struct {
|
||||
}
|
||||
|
||||
type CloudCredentialSpec struct {
|
||||
DisplayName string `json:"displayName"`
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
@@ -76,7 +76,9 @@ func schemaTypes(schemas *types.Schemas) *types.Schemas {
|
||||
func credTypes(schemas *types.Schemas) *types.Schemas {
|
||||
return schemas.
|
||||
AddMapperForType(&Version, v3.CloudCredential{},
|
||||
&m.DisplayName{},
|
||||
&mapper.CredentialMapper{},
|
||||
&m.AnnotationField{Field: "name"},
|
||||
&m.Drop{Field: "namespaceId"}).
|
||||
MustImport(&Version, v3.CloudCredential{})
|
||||
}
|
||||
|
@@ -14,6 +14,13 @@ type CredentialMapper struct {
|
||||
|
||||
func (s CredentialMapper) FromInternal(data map[string]interface{}) {
|
||||
formatData(data)
|
||||
name := convert.ToString(values.GetValueN(data, "name"))
|
||||
if name == "" {
|
||||
id := convert.ToString(values.GetValueN(data, "id"))
|
||||
if id != "" {
|
||||
data["name"] = id
|
||||
}
|
||||
}
|
||||
delete(data, "data")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user