package testing
import "k8s.io/client-go/testing"
Index ¶
- func ExtractFromListOptions(opts interface{}) (labelSelector labels.Selector, fieldSelector fields.Selector, resourceVersion string)
- type Action
- type ActionImpl
- func (a ActionImpl) DeepCopy() Action
- func (a ActionImpl) GetNamespace() string
- func (a ActionImpl) GetResource() schema.GroupVersionResource
- func (a ActionImpl) GetSubresource() string
- func (a ActionImpl) GetVerb() string
- func (a ActionImpl) Matches(verb, resource string) bool
- type CreateAction
- type CreateActionImpl
- func NewCreateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object) CreateActionImpl
- func NewCreateActionWithOptions(resource schema.GroupVersionResource, namespace string, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl
- func NewCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource, namespace string, object runtime.Object) CreateActionImpl
- func NewCreateSubresourceActionWithOptions(resource schema.GroupVersionResource, name, subresource, namespace string, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl
- func NewRootCreateAction(resource schema.GroupVersionResource, object runtime.Object) CreateActionImpl
- func NewRootCreateActionWithOptions(resource schema.GroupVersionResource, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl
- func NewRootCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource string, object runtime.Object) CreateActionImpl
- func NewRootCreateSubresourceActionWithOptions(resource schema.GroupVersionResource, name, subresource string, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl
- func (a CreateActionImpl) DeepCopy() Action
- func (a CreateActionImpl) GetCreateOptions() metav1.CreateOptions
- func (a CreateActionImpl) GetObject() runtime.Object
- type DeleteAction
- type DeleteActionImpl
- func NewDeleteAction(resource schema.GroupVersionResource, namespace, name string) DeleteActionImpl
- func NewDeleteActionWithOptions(resource schema.GroupVersionResource, namespace, name string, opts metav1.DeleteOptions) DeleteActionImpl
- func NewDeleteSubresourceAction(resource schema.GroupVersionResource, subresource, namespace, name string) DeleteActionImpl
- func NewDeleteSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource, namespace, name string, opts metav1.DeleteOptions) DeleteActionImpl
- func NewRootDeleteAction(resource schema.GroupVersionResource, name string) DeleteActionImpl
- func NewRootDeleteActionWithOptions(resource schema.GroupVersionResource, name string, opts metav1.DeleteOptions) DeleteActionImpl
- func NewRootDeleteSubresourceAction(resource schema.GroupVersionResource, subresource string, name string) DeleteActionImpl
- func NewRootDeleteSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource string, name string, opts metav1.DeleteOptions) DeleteActionImpl
- func (a DeleteActionImpl) DeepCopy() Action
- func (a DeleteActionImpl) GetDeleteOptions() metav1.DeleteOptions
- func (a DeleteActionImpl) GetName() string
- type DeleteCollectionAction
- type DeleteCollectionActionImpl
- func NewDeleteCollectionAction(resource schema.GroupVersionResource, namespace string, opts interface{}) DeleteCollectionActionImpl
- func NewDeleteCollectionActionWithOptions(resource schema.GroupVersionResource, namespace string, deleteOpts metav1.DeleteOptions, listOpts metav1.ListOptions) DeleteCollectionActionImpl
- func NewRootDeleteCollectionAction(resource schema.GroupVersionResource, opts interface{}) DeleteCollectionActionImpl
- func NewRootDeleteCollectionActionWithOptions(resource schema.GroupVersionResource, deleteOpts metav1.DeleteOptions, listOpts metav1.ListOptions) DeleteCollectionActionImpl
- func (a DeleteCollectionActionImpl) DeepCopy() Action
- func (a DeleteCollectionActionImpl) GetDeleteOptions() metav1.DeleteOptions
- func (a DeleteCollectionActionImpl) GetListOptions() metav1.ListOptions
- func (a DeleteCollectionActionImpl) GetListRestrictions() ListRestrictions
- type Fake
- func (c *Fake) Actions() []Action
- func (c *Fake) AddProxyReactor(resource string, reaction ProxyReactionFunc)
- func (c *Fake) AddReactor(verb, resource string, reaction ReactionFunc)
- func (c *Fake) AddWatchReactor(resource string, reaction WatchReactionFunc)
- func (c *Fake) ClearActions()
- func (c *Fake) Invokes(action Action, defaultReturnObj runtime.Object) (runtime.Object, error)
- func (c *Fake) InvokesProxy(action Action) restclient.ResponseWrapper
- func (c *Fake) InvokesWatch(action Action) (watch.Interface, error)
- func (c *Fake) PrependProxyReactor(resource string, reaction ProxyReactionFunc)
- func (c *Fake) PrependReactor(verb, resource string, reaction ReactionFunc)
- func (c *Fake) PrependWatchReactor(resource string, reaction WatchReactionFunc)
- type FakeClient
- type GenericAction
- type GenericActionImpl
- type GetAction
- type GetActionImpl
- func NewGetAction(resource schema.GroupVersionResource, namespace, name string) GetActionImpl
- func NewGetActionWithOptions(resource schema.GroupVersionResource, namespace, name string, opts metav1.GetOptions) GetActionImpl
- func NewGetSubresourceAction(resource schema.GroupVersionResource, namespace, subresource, name string) GetActionImpl
- func NewGetSubresourceActionWithOptions(resource schema.GroupVersionResource, namespace, subresource, name string, opts metav1.GetOptions) GetActionImpl
- func NewRootGetAction(resource schema.GroupVersionResource, name string) GetActionImpl
- func NewRootGetActionWithOptions(resource schema.GroupVersionResource, name string, opts metav1.GetOptions) GetActionImpl
- func NewRootGetSubresourceAction(resource schema.GroupVersionResource, subresource, name string) GetActionImpl
- func NewRootGetSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource, name string, opts metav1.GetOptions) GetActionImpl
- func (a GetActionImpl) DeepCopy() Action
- func (a GetActionImpl) GetGetOptions() metav1.GetOptions
- func (a GetActionImpl) GetName() string
- type ListAction
- type ListActionImpl
- func NewListAction(resource schema.GroupVersionResource, kind schema.GroupVersionKind, namespace string, opts interface{}) ListActionImpl
- func NewListActionWithOptions(resource schema.GroupVersionResource, kind schema.GroupVersionKind, namespace string, opts metav1.ListOptions) ListActionImpl
- func NewRootListAction(resource schema.GroupVersionResource, kind schema.GroupVersionKind, opts interface{}) ListActionImpl
- func NewRootListActionWithOptions(resource schema.GroupVersionResource, kind schema.GroupVersionKind, opts metav1.ListOptions) ListActionImpl
- func (a ListActionImpl) DeepCopy() Action
- func (a ListActionImpl) GetKind() schema.GroupVersionKind
- func (a ListActionImpl) GetListOptions() metav1.ListOptions
- func (a ListActionImpl) GetListRestrictions() ListRestrictions
- type ListRestrictions
- type ObjectScheme
- type ObjectTracker
- func NewFieldManagedObjectTracker(scheme *runtime.Scheme, decoder runtime.Decoder, typeConverter managedfields.TypeConverter) ObjectTracker
- func NewObjectTracker(scheme ObjectScheme, decoder runtime.Decoder) ObjectTracker
- type PatchAction
- type PatchActionImpl
- func NewPatchAction(resource schema.GroupVersionResource, namespace string, name string, pt types.PatchType, patch []byte) PatchActionImpl
- func NewPatchActionWithOptions(resource schema.GroupVersionResource, namespace string, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions) PatchActionImpl
- func NewPatchSubresourceAction(resource schema.GroupVersionResource, namespace, name string, pt types.PatchType, patch []byte, subresources ...string) PatchActionImpl
- func NewPatchSubresourceActionWithOptions(resource schema.GroupVersionResource, namespace, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions, subresources ...string) PatchActionImpl
- func NewRootPatchAction(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte) PatchActionImpl
- func NewRootPatchActionWithOptions(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions) PatchActionImpl
- func NewRootPatchSubresourceAction(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, subresources ...string) PatchActionImpl
- func NewRootPatchSubresourceActionWithOptions(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions, subresources ...string) PatchActionImpl
- func (a PatchActionImpl) DeepCopy() Action
- func (a PatchActionImpl) GetName() string
- func (a PatchActionImpl) GetPatch() []byte
- func (a PatchActionImpl) GetPatchOptions() metav1.PatchOptions
- func (a PatchActionImpl) GetPatchType() types.PatchType
- type ProxyGetAction
- type ProxyGetActionImpl
- func NewProxyGetAction(resource schema.GroupVersionResource, namespace, scheme, name, port, path string, params map[string]string) ProxyGetActionImpl
- func (a ProxyGetActionImpl) DeepCopy() Action
- func (a ProxyGetActionImpl) GetName() string
- func (a ProxyGetActionImpl) GetParams() map[string]string
- func (a ProxyGetActionImpl) GetPath() string
- func (a ProxyGetActionImpl) GetPort() string
- func (a ProxyGetActionImpl) GetScheme() string
- type ProxyReactionFunc
- type ProxyReactor
- type ReactionFunc
- type Reactor
- type SimpleProxyReactor
- func (r *SimpleProxyReactor) Handles(action Action) bool
- func (r *SimpleProxyReactor) React(action Action) (bool, restclient.ResponseWrapper, error)
- type SimpleReactor
- func (r *SimpleReactor) Handles(action Action) bool
- func (r *SimpleReactor) React(action Action) (bool, runtime.Object, error)
- type SimpleWatchReactor
- func (r *SimpleWatchReactor) Handles(action Action) bool
- func (r *SimpleWatchReactor) React(action Action) (bool, watch.Interface, error)
- type TypeConverter
- func (tc TypeConverter) ObjectToTyped(obj runtime.Object, opts ...typed.ValidationOptions) (*typed.TypedValue, error)
- func (tc TypeConverter) TypedToObject(value *typed.TypedValue) (runtime.Object, error)
- type TypeResolver
- type UpdateAction
- type UpdateActionImpl
- func NewRootUpdateAction(resource schema.GroupVersionResource, object runtime.Object) UpdateActionImpl
- func NewRootUpdateActionWithOptions(resource schema.GroupVersionResource, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl
- func NewRootUpdateSubresourceAction(resource schema.GroupVersionResource, subresource string, object runtime.Object) UpdateActionImpl
- func NewRootUpdateSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource string, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl
- func NewUpdateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object) UpdateActionImpl
- func NewUpdateActionWithOptions(resource schema.GroupVersionResource, namespace string, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl
- func NewUpdateSubresourceAction(resource schema.GroupVersionResource, subresource string, namespace string, object runtime.Object) UpdateActionImpl
- func NewUpdateSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource string, namespace string, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl
- func (a UpdateActionImpl) DeepCopy() Action
- func (a UpdateActionImpl) GetObject() runtime.Object
- func (a UpdateActionImpl) GetUpdateOptions() metav1.UpdateOptions
- type WatchAction
- type WatchActionImpl
- func NewRootWatchAction(resource schema.GroupVersionResource, opts interface{}) WatchActionImpl
- func NewRootWatchActionWithOptions(resource schema.GroupVersionResource, opts metav1.ListOptions) WatchActionImpl
- func NewWatchAction(resource schema.GroupVersionResource, namespace string, opts interface{}) WatchActionImpl
- func NewWatchActionWithOptions(resource schema.GroupVersionResource, namespace string, opts metav1.ListOptions) WatchActionImpl
- func (a WatchActionImpl) DeepCopy() Action
- func (a WatchActionImpl) GetListOptions() metav1.ListOptions
- func (a WatchActionImpl) GetWatchRestrictions() WatchRestrictions
- type WatchReactionFunc
- type WatchReactor
- type WatchRestrictions
Functions ¶
func ExtractFromListOptions ¶
func ExtractFromListOptions(opts interface{}) (labelSelector labels.Selector, fieldSelector fields.Selector, resourceVersion string)
Types ¶
type Action ¶
type Action interface { GetNamespace() string GetVerb() string GetResource() schema.GroupVersionResource GetSubresource() string Matches(verb, resource string) bool // DeepCopy is used to copy an action to avoid any risk of accidental mutation. Most people never need to call this // because the invocation logic deep copies before calls to storage and reactors. DeepCopy() Action }
type ActionImpl ¶
type ActionImpl struct { Namespace string Verb string Resource schema.GroupVersionResource Subresource string }
func (ActionImpl) DeepCopy ¶
func (a ActionImpl) DeepCopy() Action
func (ActionImpl) GetNamespace ¶
func (a ActionImpl) GetNamespace() string
func (ActionImpl) GetResource ¶
func (a ActionImpl) GetResource() schema.GroupVersionResource
func (ActionImpl) GetSubresource ¶
func (a ActionImpl) GetSubresource() string
func (ActionImpl) GetVerb ¶
func (a ActionImpl) GetVerb() string
func (ActionImpl) Matches ¶
func (a ActionImpl) Matches(verb, resource string) bool
type CreateAction ¶
type CreateActionImpl ¶
type CreateActionImpl struct { ActionImpl Name string Object runtime.Object CreateOptions metav1.CreateOptions }
func NewCreateAction ¶
func NewCreateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object) CreateActionImpl
func NewCreateActionWithOptions ¶
func NewCreateActionWithOptions(resource schema.GroupVersionResource, namespace string, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl
func NewCreateSubresourceAction ¶
func NewCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource, namespace string, object runtime.Object) CreateActionImpl
func NewCreateSubresourceActionWithOptions ¶
func NewCreateSubresourceActionWithOptions(resource schema.GroupVersionResource, name, subresource, namespace string, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl
func NewRootCreateAction ¶
func NewRootCreateAction(resource schema.GroupVersionResource, object runtime.Object) CreateActionImpl
func NewRootCreateActionWithOptions ¶
func NewRootCreateActionWithOptions(resource schema.GroupVersionResource, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl
func NewRootCreateSubresourceAction ¶
func NewRootCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource string, object runtime.Object) CreateActionImpl
func NewRootCreateSubresourceActionWithOptions ¶
func NewRootCreateSubresourceActionWithOptions(resource schema.GroupVersionResource, name, subresource string, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl
func (CreateActionImpl) DeepCopy ¶
func (a CreateActionImpl) DeepCopy() Action
func (CreateActionImpl) GetCreateOptions ¶
func (a CreateActionImpl) GetCreateOptions() metav1.CreateOptions
func (CreateActionImpl) GetObject ¶
func (a CreateActionImpl) GetObject() runtime.Object
type DeleteAction ¶
type DeleteAction interface { Action GetName() string GetDeleteOptions() metav1.DeleteOptions }
type DeleteActionImpl ¶
type DeleteActionImpl struct { ActionImpl Name string DeleteOptions metav1.DeleteOptions }
func NewDeleteAction ¶
func NewDeleteAction(resource schema.GroupVersionResource, namespace, name string) DeleteActionImpl
func NewDeleteActionWithOptions ¶
func NewDeleteActionWithOptions(resource schema.GroupVersionResource, namespace, name string, opts metav1.DeleteOptions) DeleteActionImpl
func NewDeleteSubresourceAction ¶
func NewDeleteSubresourceAction(resource schema.GroupVersionResource, subresource, namespace, name string) DeleteActionImpl
func NewDeleteSubresourceActionWithOptions ¶
func NewDeleteSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource, namespace, name string, opts metav1.DeleteOptions) DeleteActionImpl
func NewRootDeleteAction ¶
func NewRootDeleteAction(resource schema.GroupVersionResource, name string) DeleteActionImpl
func NewRootDeleteActionWithOptions ¶
func NewRootDeleteActionWithOptions(resource schema.GroupVersionResource, name string, opts metav1.DeleteOptions) DeleteActionImpl
func NewRootDeleteSubresourceAction ¶
func NewRootDeleteSubresourceAction(resource schema.GroupVersionResource, subresource string, name string) DeleteActionImpl
func NewRootDeleteSubresourceActionWithOptions ¶
func NewRootDeleteSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource string, name string, opts metav1.DeleteOptions) DeleteActionImpl
func (DeleteActionImpl) DeepCopy ¶
func (a DeleteActionImpl) DeepCopy() Action
func (DeleteActionImpl) GetDeleteOptions ¶
func (a DeleteActionImpl) GetDeleteOptions() metav1.DeleteOptions
func (DeleteActionImpl) GetName ¶
func (a DeleteActionImpl) GetName() string
type DeleteCollectionAction ¶
type DeleteCollectionAction interface { Action GetListRestrictions() ListRestrictions }
type DeleteCollectionActionImpl ¶
type DeleteCollectionActionImpl struct { ActionImpl ListRestrictions ListRestrictions DeleteOptions metav1.DeleteOptions ListOptions metav1.ListOptions }
func NewDeleteCollectionAction ¶
func NewDeleteCollectionAction(resource schema.GroupVersionResource, namespace string, opts interface{}) DeleteCollectionActionImpl
func NewDeleteCollectionActionWithOptions ¶
func NewDeleteCollectionActionWithOptions(resource schema.GroupVersionResource, namespace string, deleteOpts metav1.DeleteOptions, listOpts metav1.ListOptions) DeleteCollectionActionImpl
func NewRootDeleteCollectionAction ¶
func NewRootDeleteCollectionAction(resource schema.GroupVersionResource, opts interface{}) DeleteCollectionActionImpl
func NewRootDeleteCollectionActionWithOptions ¶
func NewRootDeleteCollectionActionWithOptions(resource schema.GroupVersionResource, deleteOpts metav1.DeleteOptions, listOpts metav1.ListOptions) DeleteCollectionActionImpl
func (DeleteCollectionActionImpl) DeepCopy ¶
func (a DeleteCollectionActionImpl) DeepCopy() Action
func (DeleteCollectionActionImpl) GetDeleteOptions ¶
func (a DeleteCollectionActionImpl) GetDeleteOptions() metav1.DeleteOptions
func (DeleteCollectionActionImpl) GetListOptions ¶
func (a DeleteCollectionActionImpl) GetListOptions() metav1.ListOptions
func (DeleteCollectionActionImpl) GetListRestrictions ¶
func (a DeleteCollectionActionImpl) GetListRestrictions() ListRestrictions
type Fake ¶
type Fake struct { sync.RWMutex // ReactionChain is the list of reactors that will be attempted for every // request in the order they are tried. ReactionChain []Reactor // WatchReactionChain is the list of watch reactors that will be attempted // for every request in the order they are tried. WatchReactionChain []WatchReactor // ProxyReactionChain is the list of proxy reactors that will be attempted // for every request in the order they are tried. ProxyReactionChain []ProxyReactor Resources []*metav1.APIResourceList // contains filtered or unexported fields }
Fake implements client.Interface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.
func (*Fake) Actions ¶
Actions returns a chronologically ordered slice fake actions called on the fake client.
func (*Fake) AddProxyReactor ¶
func (c *Fake) AddProxyReactor(resource string, reaction ProxyReactionFunc)
AddProxyReactor appends a reactor to the end of the chain.
func (*Fake) AddReactor ¶
func (c *Fake) AddReactor(verb, resource string, reaction ReactionFunc)
AddReactor appends a reactor to the end of the chain.
func (*Fake) AddWatchReactor ¶
func (c *Fake) AddWatchReactor(resource string, reaction WatchReactionFunc)
AddWatchReactor appends a reactor to the end of the chain.
func (*Fake) ClearActions ¶
func (c *Fake) ClearActions()
ClearActions clears the history of actions called on the fake client.
func (*Fake) Invokes ¶
Invokes records the provided Action and then invokes the ReactionFunc that handles the action if one exists. defaultReturnObj is expected to be of the same type a normal call would return.
func (*Fake) InvokesProxy ¶
func (c *Fake) InvokesProxy(action Action) restclient.ResponseWrapper
InvokesProxy records the provided Action and then invokes the ReactionFunc that handles the action if one exists.
func (*Fake) InvokesWatch ¶
InvokesWatch records the provided Action and then invokes the ReactionFunc that handles the action if one exists.
func (*Fake) PrependProxyReactor ¶
func (c *Fake) PrependProxyReactor(resource string, reaction ProxyReactionFunc)
PrependProxyReactor adds a reactor to the beginning of the chain.
func (*Fake) PrependReactor ¶
func (c *Fake) PrependReactor(verb, resource string, reaction ReactionFunc)
PrependReactor adds a reactor to the beginning of the chain.
func (*Fake) PrependWatchReactor ¶
func (c *Fake) PrependWatchReactor(resource string, reaction WatchReactionFunc)
PrependWatchReactor adds a reactor to the beginning of the chain.
type FakeClient ¶
type FakeClient interface { // Tracker gives access to the ObjectTracker internal to the fake client. Tracker() ObjectTracker // AddReactor appends a reactor to the end of the chain. AddReactor(verb, resource string, reaction ReactionFunc) // PrependReactor adds a reactor to the beginning of the chain. PrependReactor(verb, resource string, reaction ReactionFunc) // AddWatchReactor appends a reactor to the end of the chain. AddWatchReactor(resource string, reaction WatchReactionFunc) // PrependWatchReactor adds a reactor to the beginning of the chain. PrependWatchReactor(resource string, reaction WatchReactionFunc) // AddProxyReactor appends a reactor to the end of the chain. AddProxyReactor(resource string, reaction ProxyReactionFunc) // PrependProxyReactor adds a reactor to the beginning of the chain. PrependProxyReactor(resource string, reaction ProxyReactionFunc) // Invokes records the provided Action and then invokes the ReactionFunc that // handles the action if one exists. defaultReturnObj is expected to be of the // same type a normal call would return. Invokes(action Action, defaultReturnObj runtime.Object) (runtime.Object, error) // InvokesWatch records the provided Action and then invokes the ReactionFunc // that handles the action if one exists. InvokesWatch(action Action) (watch.Interface, error) // InvokesProxy records the provided Action and then invokes the ReactionFunc // that handles the action if one exists. InvokesProxy(action Action) restclient.ResponseWrapper // ClearActions clears the history of actions called on the fake client. ClearActions() // Actions returns a chronologically ordered slice fake actions called on the // fake client. Actions() []Action }
type GenericAction ¶
type GenericAction interface { Action GetValue() interface{} }
type GenericActionImpl ¶
type GenericActionImpl struct { ActionImpl Value interface{} }
func (GenericActionImpl) DeepCopy ¶
func (a GenericActionImpl) DeepCopy() Action
func (GenericActionImpl) GetValue ¶
func (a GenericActionImpl) GetValue() interface{}
type GetAction ¶
type GetActionImpl ¶
type GetActionImpl struct { ActionImpl Name string GetOptions metav1.GetOptions }
func NewGetAction ¶
func NewGetAction(resource schema.GroupVersionResource, namespace, name string) GetActionImpl
func NewGetActionWithOptions ¶
func NewGetActionWithOptions(resource schema.GroupVersionResource, namespace, name string, opts metav1.GetOptions) GetActionImpl
func NewGetSubresourceAction ¶
func NewGetSubresourceAction(resource schema.GroupVersionResource, namespace, subresource, name string) GetActionImpl
func NewGetSubresourceActionWithOptions ¶
func NewGetSubresourceActionWithOptions(resource schema.GroupVersionResource, namespace, subresource, name string, opts metav1.GetOptions) GetActionImpl
func NewRootGetAction ¶
func NewRootGetAction(resource schema.GroupVersionResource, name string) GetActionImpl
func NewRootGetActionWithOptions ¶
func NewRootGetActionWithOptions(resource schema.GroupVersionResource, name string, opts metav1.GetOptions) GetActionImpl
func NewRootGetSubresourceAction ¶
func NewRootGetSubresourceAction(resource schema.GroupVersionResource, subresource, name string) GetActionImpl
func NewRootGetSubresourceActionWithOptions ¶
func NewRootGetSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource, name string, opts metav1.GetOptions) GetActionImpl
func (GetActionImpl) DeepCopy ¶
func (a GetActionImpl) DeepCopy() Action
func (GetActionImpl) GetGetOptions ¶
func (a GetActionImpl) GetGetOptions() metav1.GetOptions
func (GetActionImpl) GetName ¶
func (a GetActionImpl) GetName() string
type ListAction ¶
type ListAction interface { Action GetListRestrictions() ListRestrictions }
type ListActionImpl ¶
type ListActionImpl struct { ActionImpl Kind schema.GroupVersionKind Name string ListRestrictions ListRestrictions ListOptions metav1.ListOptions }
func NewListAction ¶
func NewListAction(resource schema.GroupVersionResource, kind schema.GroupVersionKind, namespace string, opts interface{}) ListActionImpl
func NewListActionWithOptions ¶
func NewListActionWithOptions(resource schema.GroupVersionResource, kind schema.GroupVersionKind, namespace string, opts metav1.ListOptions) ListActionImpl
func NewRootListAction ¶
func NewRootListAction(resource schema.GroupVersionResource, kind schema.GroupVersionKind, opts interface{}) ListActionImpl
func NewRootListActionWithOptions ¶
func NewRootListActionWithOptions(resource schema.GroupVersionResource, kind schema.GroupVersionKind, opts metav1.ListOptions) ListActionImpl
func (ListActionImpl) DeepCopy ¶
func (a ListActionImpl) DeepCopy() Action
func (ListActionImpl) GetKind ¶
func (a ListActionImpl) GetKind() schema.GroupVersionKind
func (ListActionImpl) GetListOptions ¶
func (a ListActionImpl) GetListOptions() metav1.ListOptions
func (ListActionImpl) GetListRestrictions ¶
func (a ListActionImpl) GetListRestrictions() ListRestrictions
type ListRestrictions ¶
type ObjectScheme ¶
type ObjectScheme interface { runtime.ObjectCreater runtime.ObjectTyper }
ObjectScheme abstracts the implementation of common operations on objects.
type ObjectTracker ¶
type ObjectTracker interface { // Add adds an object to the tracker. If object being added // is a list, its items are added separately. Add(obj runtime.Object) error // Get retrieves the object by its kind, namespace and name. Get(gvr schema.GroupVersionResource, ns, name string, opts ...metav1.GetOptions) (runtime.Object, error) // Create adds an object to the tracker in the specified namespace. Create(gvr schema.GroupVersionResource, obj runtime.Object, ns string, opts ...metav1.CreateOptions) error // Update updates an existing object in the tracker in the specified namespace. Update(gvr schema.GroupVersionResource, obj runtime.Object, ns string, opts ...metav1.UpdateOptions) error // Patch patches an existing object in the tracker in the specified namespace. Patch(gvr schema.GroupVersionResource, obj runtime.Object, ns string, opts ...metav1.PatchOptions) error // Apply applies an object in the tracker in the specified namespace. Apply(gvr schema.GroupVersionResource, applyConfiguration runtime.Object, ns string, opts ...metav1.PatchOptions) error // List retrieves all objects of a given kind in the given // namespace. Only non-List kinds are accepted. List(gvr schema.GroupVersionResource, gvk schema.GroupVersionKind, ns string, opts ...metav1.ListOptions) (runtime.Object, error) // Delete deletes an existing object from the tracker. If object // didn't exist in the tracker prior to deletion, Delete returns // no error. Delete(gvr schema.GroupVersionResource, ns, name string, opts ...metav1.DeleteOptions) error // Watch watches objects from the tracker. Watch returns a channel // which will push added / modified / deleted object. Watch(gvr schema.GroupVersionResource, ns string, opts ...metav1.ListOptions) (watch.Interface, error) }
ObjectTracker keeps track of objects. It is intended to be used to fake calls to a server by returning objects based on their kind, namespace and name.
func NewFieldManagedObjectTracker ¶
func NewFieldManagedObjectTracker(scheme *runtime.Scheme, decoder runtime.Decoder, typeConverter managedfields.TypeConverter) ObjectTracker
NewFieldManagedObjectTracker returns an ObjectTracker that can be used to keep track of objects and managed fields for the fake clientset. Mostly useful for unit tests.
func NewObjectTracker ¶
func NewObjectTracker(scheme ObjectScheme, decoder runtime.Decoder) ObjectTracker
NewObjectTracker returns an ObjectTracker that can be used to keep track of objects for the fake clientset. Mostly useful for unit tests.
type PatchAction ¶
type PatchAction interface { Action GetName() string GetPatchType() types.PatchType GetPatch() []byte }
type PatchActionImpl ¶
type PatchActionImpl struct { ActionImpl Name string PatchType types.PatchType Patch []byte PatchOptions metav1.PatchOptions }
func NewPatchAction ¶
func NewPatchAction(resource schema.GroupVersionResource, namespace string, name string, pt types.PatchType, patch []byte) PatchActionImpl
func NewPatchActionWithOptions ¶
func NewPatchActionWithOptions(resource schema.GroupVersionResource, namespace string, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions) PatchActionImpl
func NewPatchSubresourceAction ¶
func NewPatchSubresourceAction(resource schema.GroupVersionResource, namespace, name string, pt types.PatchType, patch []byte, subresources ...string) PatchActionImpl
func NewPatchSubresourceActionWithOptions ¶
func NewPatchSubresourceActionWithOptions(resource schema.GroupVersionResource, namespace, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions, subresources ...string) PatchActionImpl
func NewRootPatchAction ¶
func NewRootPatchAction(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte) PatchActionImpl
func NewRootPatchActionWithOptions ¶
func NewRootPatchActionWithOptions(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions) PatchActionImpl
func NewRootPatchSubresourceAction ¶
func NewRootPatchSubresourceAction(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, subresources ...string) PatchActionImpl
func NewRootPatchSubresourceActionWithOptions ¶
func NewRootPatchSubresourceActionWithOptions(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions, subresources ...string) PatchActionImpl
func (PatchActionImpl) DeepCopy ¶
func (a PatchActionImpl) DeepCopy() Action
func (PatchActionImpl) GetName ¶
func (a PatchActionImpl) GetName() string
func (PatchActionImpl) GetPatch ¶
func (a PatchActionImpl) GetPatch() []byte
func (PatchActionImpl) GetPatchOptions ¶
func (a PatchActionImpl) GetPatchOptions() metav1.PatchOptions
func (PatchActionImpl) GetPatchType ¶
func (a PatchActionImpl) GetPatchType() types.PatchType
type ProxyGetAction ¶
type ProxyGetAction interface { Action GetScheme() string GetName() string GetPort() string GetPath() string GetParams() map[string]string }
type ProxyGetActionImpl ¶
type ProxyGetActionImpl struct { ActionImpl Scheme string Name string Port string Path string Params map[string]string }
func NewProxyGetAction ¶
func NewProxyGetAction(resource schema.GroupVersionResource, namespace, scheme, name, port, path string, params map[string]string) ProxyGetActionImpl
func (ProxyGetActionImpl) DeepCopy ¶
func (a ProxyGetActionImpl) DeepCopy() Action
func (ProxyGetActionImpl) GetName ¶
func (a ProxyGetActionImpl) GetName() string
func (ProxyGetActionImpl) GetParams ¶
func (a ProxyGetActionImpl) GetParams() map[string]string
func (ProxyGetActionImpl) GetPath ¶
func (a ProxyGetActionImpl) GetPath() string
func (ProxyGetActionImpl) GetPort ¶
func (a ProxyGetActionImpl) GetPort() string
func (ProxyGetActionImpl) GetScheme ¶
func (a ProxyGetActionImpl) GetScheme() string
type ProxyReactionFunc ¶
type ProxyReactionFunc func(action Action) (handled bool, ret restclient.ResponseWrapper, err error)
ProxyReactionFunc is a function that returns a ResponseWrapper interface for a given Action. If "handled" is false, then the test client will ignore the results and continue to the next ProxyReactionFunc.
type ProxyReactor ¶
type ProxyReactor interface { // Handles indicates whether or not this Reactor deals with a given // action. Handles(action Action) bool // React handles a watch action and returns results. It may choose to // delegate by indicating handled=false. React(action Action) (handled bool, ret restclient.ResponseWrapper, err error) }
ProxyReactor is an interface to allow the composition of proxy get functions.
type ReactionFunc ¶
ReactionFunc is a function that returns an object or error for a given Action. If "handled" is false, then the test client will ignore the results and continue to the next ReactionFunc. A ReactionFunc can describe reactions on subresources by testing the result of the action's GetSubresource() method.
func ObjectReaction ¶
func ObjectReaction(tracker ObjectTracker) ReactionFunc
ObjectReaction returns a ReactionFunc that applies core.Action to the given tracker.
If tracker also implements ManagedFieldObjectTracker, then managed fields will be handled by the tracker and apply patch actions will be evaluated using the field manager and will take field ownership into consideration. Without a ManagedFieldObjectTracker, apply patch actions do not consider field ownership.
WARNING: There is no server side defaulting, validation, or conversion handled by the fake client and subresources are not handled accurately (fields in the root resource are not automatically updated when a scale resource is updated, for example).
type Reactor ¶
type Reactor interface { // Handles indicates whether or not this Reactor deals with a given // action. Handles(action Action) bool // React handles the action and returns results. It may choose to // delegate by indicated handled=false. React(action Action) (handled bool, ret runtime.Object, err error) }
Reactor is an interface to allow the composition of reaction functions.
type SimpleProxyReactor ¶
type SimpleProxyReactor struct { Resource string Reaction ProxyReactionFunc }
SimpleProxyReactor is a ProxyReactor. Each reaction function is attached to a given resource. "*" matches everything for that value. For instance, *,pods matches all verbs on pods. This allows for easier composition of reaction functions.
func (*SimpleProxyReactor) Handles ¶
func (r *SimpleProxyReactor) Handles(action Action) bool
func (*SimpleProxyReactor) React ¶
func (r *SimpleProxyReactor) React(action Action) (bool, restclient.ResponseWrapper, error)
type SimpleReactor ¶
type SimpleReactor struct { Verb string Resource string Reaction ReactionFunc }
SimpleReactor is a Reactor. Each reaction function is attached to a given verb,resource tuple. "*" in either field matches everything for that value. For instance, *,pods matches all verbs on pods. This allows for easier composition of reaction functions
func (*SimpleReactor) Handles ¶
func (r *SimpleReactor) Handles(action Action) bool
func (*SimpleReactor) React ¶
type SimpleWatchReactor ¶
type SimpleWatchReactor struct { Resource string Reaction WatchReactionFunc }
SimpleWatchReactor is a WatchReactor. Each reaction function is attached to a given resource. "*" matches everything for that value. For instance, *,pods matches all verbs on pods. This allows for easier composition of reaction functions
func (*SimpleWatchReactor) Handles ¶
func (r *SimpleWatchReactor) Handles(action Action) bool
func (*SimpleWatchReactor) React ¶
type TypeConverter ¶
type TypeConverter struct { Scheme *runtime.Scheme TypeResolver TypeResolver }
func (TypeConverter) ObjectToTyped ¶
func (tc TypeConverter) ObjectToTyped(obj runtime.Object, opts ...typed.ValidationOptions) (*typed.TypedValue, error)
func (TypeConverter) TypedToObject ¶
func (tc TypeConverter) TypedToObject(value *typed.TypedValue) (runtime.Object, error)
type TypeResolver ¶
type TypeResolver interface { Type(openAPIName string) typed.ParseableType }
type UpdateAction ¶
type UpdateActionImpl ¶
type UpdateActionImpl struct { ActionImpl Object runtime.Object UpdateOptions metav1.UpdateOptions }
func NewRootUpdateAction ¶
func NewRootUpdateAction(resource schema.GroupVersionResource, object runtime.Object) UpdateActionImpl
func NewRootUpdateActionWithOptions ¶
func NewRootUpdateActionWithOptions(resource schema.GroupVersionResource, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl
func NewRootUpdateSubresourceAction ¶
func NewRootUpdateSubresourceAction(resource schema.GroupVersionResource, subresource string, object runtime.Object) UpdateActionImpl
func NewRootUpdateSubresourceActionWithOptions ¶
func NewRootUpdateSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource string, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl
func NewUpdateAction ¶
func NewUpdateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object) UpdateActionImpl
func NewUpdateActionWithOptions ¶
func NewUpdateActionWithOptions(resource schema.GroupVersionResource, namespace string, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl
func NewUpdateSubresourceAction ¶
func NewUpdateSubresourceAction(resource schema.GroupVersionResource, subresource string, namespace string, object runtime.Object) UpdateActionImpl
func NewUpdateSubresourceActionWithOptions ¶
func NewUpdateSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource string, namespace string, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl
func (UpdateActionImpl) DeepCopy ¶
func (a UpdateActionImpl) DeepCopy() Action
func (UpdateActionImpl) GetObject ¶
func (a UpdateActionImpl) GetObject() runtime.Object
func (UpdateActionImpl) GetUpdateOptions ¶
func (a UpdateActionImpl) GetUpdateOptions() metav1.UpdateOptions
type WatchAction ¶
type WatchAction interface { Action GetWatchRestrictions() WatchRestrictions }
type WatchActionImpl ¶
type WatchActionImpl struct { ActionImpl WatchRestrictions WatchRestrictions ListOptions metav1.ListOptions }
func NewRootWatchAction ¶
func NewRootWatchAction(resource schema.GroupVersionResource, opts interface{}) WatchActionImpl
func NewRootWatchActionWithOptions ¶
func NewRootWatchActionWithOptions(resource schema.GroupVersionResource, opts metav1.ListOptions) WatchActionImpl
func NewWatchAction ¶
func NewWatchAction(resource schema.GroupVersionResource, namespace string, opts interface{}) WatchActionImpl
func NewWatchActionWithOptions ¶
func NewWatchActionWithOptions(resource schema.GroupVersionResource, namespace string, opts metav1.ListOptions) WatchActionImpl
func (WatchActionImpl) DeepCopy ¶
func (a WatchActionImpl) DeepCopy() Action
func (WatchActionImpl) GetListOptions ¶
func (a WatchActionImpl) GetListOptions() metav1.ListOptions
func (WatchActionImpl) GetWatchRestrictions ¶
func (a WatchActionImpl) GetWatchRestrictions() WatchRestrictions
type WatchReactionFunc ¶
WatchReactionFunc is a function that returns a watch interface. If "handled" is false, then the test client will ignore the results and continue to the next ReactionFunc.
func DefaultWatchReactor ¶
func DefaultWatchReactor(watchInterface watch.Interface, err error) WatchReactionFunc
type WatchReactor ¶
type WatchReactor interface { // Handles indicates whether or not this Reactor deals with a given // action. Handles(action Action) bool // React handles a watch action and returns results. It may choose to // delegate by indicating handled=false. React(action Action) (handled bool, ret watch.Interface, err error) }
WatchReactor is an interface to allow the composition of watch functions.
type WatchRestrictions ¶
type WatchRestrictions struct { Labels labels.Selector Fields fields.Selector ResourceVersion string }
Source Files ¶
actions.go fake.go fixture.go interface.go
- Version
- v0.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 24 packages
- Last checked
- 23 minutes ago –
Tools for package owners.