mirror of
https://github.com/rancher/norman.git
synced 2025-09-01 15:18:20 +00:00
Update to k8s 1.18
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package objectclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -133,7 +134,7 @@ func (p *ObjectClient) Create(o runtime.Object) (runtime.Object, error) {
|
||||
NamespaceIfScoped(ns, p.resource.Namespaced).
|
||||
Resource(p.resource.Name).
|
||||
Body(o).
|
||||
Do().
|
||||
Do(context.TODO()).
|
||||
Into(result)
|
||||
return result, err
|
||||
}
|
||||
@@ -149,7 +150,7 @@ func (p *ObjectClient) GetNamespaced(namespace, name string, opts metav1.GetOpti
|
||||
Resource(p.resource.Name).
|
||||
VersionedParams(&opts, metav1.ParameterCodec).
|
||||
Name(name).
|
||||
Do().
|
||||
Do(context.TODO()).
|
||||
Into(result)
|
||||
logrus.Tracef("REST GET %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, namespace, p.resource.Name, name)
|
||||
return result, err
|
||||
@@ -164,7 +165,7 @@ func (p *ObjectClient) Get(name string, opts metav1.GetOptions) (runtime.Object,
|
||||
Resource(p.resource.Name).
|
||||
VersionedParams(&opts, metav1.ParameterCodec).
|
||||
Name(name).
|
||||
Do().
|
||||
Do(context.TODO()).
|
||||
Into(result)
|
||||
logrus.Tracef("REST GET %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, p.ns, p.resource.Name, name)
|
||||
return result, err
|
||||
@@ -186,7 +187,7 @@ func (p *ObjectClient) Update(name string, o runtime.Object) (runtime.Object, er
|
||||
Resource(p.resource.Name).
|
||||
Name(name).
|
||||
Body(o).
|
||||
Do().
|
||||
Do(context.TODO()).
|
||||
Into(result)
|
||||
return result, err
|
||||
}
|
||||
@@ -201,7 +202,7 @@ func (p *ObjectClient) DeleteNamespaced(namespace, name string, opts *metav1.Del
|
||||
return req.Resource(p.resource.Name).
|
||||
Name(name).
|
||||
Body(opts).
|
||||
Do().
|
||||
Do(context.TODO()).
|
||||
Error()
|
||||
}
|
||||
|
||||
@@ -213,7 +214,7 @@ func (p *ObjectClient) Delete(name string, opts *metav1.DeleteOptions) error {
|
||||
Resource(p.resource.Name).
|
||||
Name(name).
|
||||
Body(opts).
|
||||
Do().
|
||||
Do(context.TODO()).
|
||||
Error()
|
||||
}
|
||||
|
||||
@@ -225,7 +226,7 @@ func (p *ObjectClient) List(opts metav1.ListOptions) (runtime.Object, error) {
|
||||
NamespaceIfScoped(p.ns, p.resource.Namespaced).
|
||||
Resource(p.resource.Name).
|
||||
VersionedParams(&opts, metav1.ParameterCodec).
|
||||
Do().
|
||||
Do(context.TODO()).
|
||||
Into(result)
|
||||
}
|
||||
|
||||
@@ -237,7 +238,7 @@ func (p *ObjectClient) ListNamespaced(namespace string, opts metav1.ListOptions)
|
||||
NamespaceIfScoped(namespace, p.resource.Namespaced).
|
||||
Resource(p.resource.Name).
|
||||
VersionedParams(&opts, metav1.ParameterCodec).
|
||||
Do().
|
||||
Do(context.TODO()).
|
||||
Into(result)
|
||||
}
|
||||
|
||||
@@ -253,7 +254,7 @@ func (p *ObjectClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||
NamespaceIfScoped(p.ns, p.resource.Namespaced).
|
||||
Resource(p.resource.Name).
|
||||
VersionedParams(&opts, metav1.ParameterCodec).
|
||||
Stream()
|
||||
Stream(context.TODO())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -302,7 +303,7 @@ func (p *ObjectClient) DeleteCollection(deleteOptions *metav1.DeleteOptions, lis
|
||||
Resource(p.resource.Name).
|
||||
VersionedParams(&listOptions, metav1.ParameterCodec).
|
||||
Body(deleteOptions).
|
||||
Do().
|
||||
Do(context.TODO()).
|
||||
Error()
|
||||
}
|
||||
|
||||
@@ -322,7 +323,7 @@ func (p *ObjectClient) Patch(name string, o runtime.Object, patchType types.Patc
|
||||
SubResource(subresources...).
|
||||
Name(name).
|
||||
Body(data).
|
||||
Do().
|
||||
Do(context.TODO()).
|
||||
Into(result)
|
||||
return result, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user