1
0
mirror of https://github.com/rancher/types.git synced 2025-09-01 05:09:10 +00:00

Update vendor

This commit is contained in:
Dan Ramich
2018-07-25 09:55:33 -07:00
committed by Alena Prokharchyk
parent f657b6b817
commit e6619dfa0b
3 changed files with 21 additions and 1 deletions

View File

@@ -194,6 +194,13 @@ func (s *{{.schema.ID}}Client) ObjectClient() *objectclient.ObjectClient {
}
func (s *{{.schema.ID}}Client) Create(o *{{.prefix}}{{.schema.CodeName}}) (*{{.prefix}}{{.schema.CodeName}}, error) {
{{- if (or (eq .schema.ID "role") (eq .schema.ID "roleBinding") (eq .schema.ID "clusterRole") (eq .schema.ID "clusterRoleBinding"))}}
if o.Labels == nil {
labels := make(map[string]string)
o.Labels = labels
}
o.Labels["creator.cattle.io/rancher-created"] = "true"
{{- end}}
obj, err := s.objectClient.Create(o)
return obj.(*{{.prefix}}{{.schema.CodeName}}), err
}
@@ -209,6 +216,13 @@ func (s *{{.schema.ID}}Client) GetNamespaced(namespace, name string, opts metav1
}
func (s *{{.schema.ID}}Client) Update(o *{{.prefix}}{{.schema.CodeName}}) (*{{.prefix}}{{.schema.CodeName}}, error) {
{{- if (or (eq .schema.ID "role") (eq .schema.ID "roleBinding") (eq .schema.ID "clusterRole") (eq .schema.ID "clusterRoleBinding"))}}
if o.Labels == nil {
labels := make(map[string]string)
o.Labels = labels
}
o.Labels["creator.cattle.io/rancher-created"] = "true"
{{- end}}
obj, err := s.objectClient.Update(o.Name, o)
return obj.(*{{.prefix}}{{.schema.CodeName}}), err
}

View File

@@ -82,12 +82,18 @@ func (t *typeMapper) FromInternal(data map[string]interface{}) {
}
}
// Attempt to set type so mappers are aware of it
if _, ok := data["type"]; !ok && data != nil {
data["type"] = t.typeName
}
Mappers(t.Mappers).FromInternal(data)
// Ensure if there is no type we set one
if _, ok := data["type"]; !ok && data != nil {
data["type"] = t.typeName
}
if data != nil && t.root {
if _, ok := data["id"]; ok {
if namespace != "" {