mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-03-16 01:21:03 +08:00
generated
Kubernetes-commit: 8f7edec615fb9cd722b7f8310dab3efa25351b7c
This commit is contained in:
parent
ff6be62b4c
commit
a5c672885d
@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
@ -76,11 +78,16 @@ func (c *foos) Get(name string, options v1.GetOptions) (result *v1alpha1.Foo, er
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of Foos that match those selectors.
|
// List takes label and field selectors, and returns the list of Foos that match those selectors.
|
||||||
func (c *foos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
|
func (c *foos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1alpha1.FooList{}
|
result = &v1alpha1.FooList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("foos").
|
Resource("foos").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@ -88,11 +95,16 @@ func (c *foos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested foos.
|
// Watch returns a watch.Interface that watches the requested foos.
|
||||||
func (c *foos) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *foos) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("foos").
|
Resource("foos").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,10 +162,15 @@ func (c *foos) Delete(name string, options *v1.DeleteOptions) error {
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *foos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *foos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("foos").
|
Resource("foos").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user