mirror of
https://github.com/rancher/norman.git
synced 2025-09-10 03:29:14 +00:00
Fix patch to require patchtype parameter
This commit is contained in:
@@ -238,8 +238,8 @@ func (s *{{.schema.ID}}Client) Watch(opts metav1.ListOptions) (watch.Interface,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Patch applies the patch and returns the patched deployment.
|
// Patch applies the patch and returns the patched deployment.
|
||||||
func (s *{{.schema.ID}}Client) Patch(o *{{.prefix}}{{.schema.CodeName}}, data []byte, subresources ...string) (*{{.prefix}}{{.schema.CodeName}}, error) {
|
func (s *{{.schema.ID}}Client) Patch(o *{{.prefix}}{{.schema.CodeName}}, patchType types.PatchType, data []byte, subresources ...string) (*{{.prefix}}{{.schema.CodeName}}, error) {
|
||||||
obj, err := s.objectClient.Patch(o.Name, o, data, subresources...)
|
obj, err := s.objectClient.Patch(o.Name, o, patchType, data, subresources...)
|
||||||
return obj.(*{{.prefix}}{{.schema.CodeName}}), err
|
return obj.(*{{.prefix}}{{.schema.CodeName}}), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ type GenericClient interface {
|
|||||||
List(opts metav1.ListOptions) (runtime.Object, error)
|
List(opts metav1.ListOptions) (runtime.Object, error)
|
||||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||||
DeleteCollection(deleteOptions *metav1.DeleteOptions, listOptions metav1.ListOptions) error
|
DeleteCollection(deleteOptions *metav1.DeleteOptions, listOptions metav1.ListOptions) error
|
||||||
Patch(name string, o runtime.Object, data []byte, subresources ...string) (runtime.Object, error)
|
Patch(name string, o runtime.Object, patchType types.PatchType, data []byte, subresources ...string) (runtime.Object, error)
|
||||||
ObjectFactory() ObjectFactory
|
ObjectFactory() ObjectFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ func (p *ObjectClient) DeleteCollection(deleteOptions *metav1.DeleteOptions, lis
|
|||||||
Error()
|
Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ObjectClient) Patch(name string, o runtime.Object, data []byte, subresources ...string) (runtime.Object, error) {
|
func (p *ObjectClient) Patch(name string, o runtime.Object, patchType types.PatchType, data []byte, subresources ...string) (runtime.Object, error) {
|
||||||
ns := p.ns
|
ns := p.ns
|
||||||
if obj, ok := o.(metav1.Object); ok && obj.GetNamespace() != "" {
|
if obj, ok := o.(metav1.Object); ok && obj.GetNamespace() != "" {
|
||||||
ns = obj.GetNamespace()
|
ns = obj.GetNamespace()
|
||||||
@@ -293,7 +293,7 @@ func (p *ObjectClient) Patch(name string, o runtime.Object, data []byte, subreso
|
|||||||
if len(name) == 0 {
|
if len(name) == 0 {
|
||||||
return result, errors.New("object missing name")
|
return result, errors.New("object missing name")
|
||||||
}
|
}
|
||||||
err := p.restClient.Patch(types.StrategicMergePatchType).
|
err := p.restClient.Patch(patchType).
|
||||||
Prefix(p.getAPIPrefix(), p.gvk.Group, p.gvk.Version).
|
Prefix(p.getAPIPrefix(), p.gvk.Group, p.gvk.Version).
|
||||||
NamespaceIfScoped(ns, p.resource.Namespaced).
|
NamespaceIfScoped(ns, p.resource.Namespaced).
|
||||||
Resource(p.resource.Name).
|
Resource(p.resource.Name).
|
||||||
|
Reference in New Issue
Block a user