mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-18 17:21:23 +00:00
Support options for all client fake actions
Kubernetes-commit: 599f03c72264d5149ae63b1c9eccb33e8b32e900
This commit is contained in:
parent
b9309ac26b
commit
96f66e9159
@ -30,41 +30,61 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NewRootGetAction(resource schema.GroupVersionResource, name string) GetActionImpl {
|
func NewRootGetAction(resource schema.GroupVersionResource, name string) GetActionImpl {
|
||||||
|
return NewRootGetActionWithOptions(resource, name, metav1.GetOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootGetActionWithOptions(resource schema.GroupVersionResource, name string, opts metav1.GetOptions) GetActionImpl {
|
||||||
action := GetActionImpl{}
|
action := GetActionImpl{}
|
||||||
action.Verb = "get"
|
action.Verb = "get"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Name = name
|
action.Name = name
|
||||||
|
action.GetOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGetAction(resource schema.GroupVersionResource, namespace, name string) GetActionImpl {
|
func NewGetAction(resource schema.GroupVersionResource, namespace, name string) GetActionImpl {
|
||||||
|
return NewGetActionWithOptions(resource, namespace, name, metav1.GetOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetActionWithOptions(resource schema.GroupVersionResource, namespace, name string, opts metav1.GetOptions) GetActionImpl {
|
||||||
action := GetActionImpl{}
|
action := GetActionImpl{}
|
||||||
action.Verb = "get"
|
action.Verb = "get"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Namespace = namespace
|
action.Namespace = namespace
|
||||||
action.Name = name
|
action.Name = name
|
||||||
|
action.GetOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGetSubresourceAction(resource schema.GroupVersionResource, namespace, subresource, name string) GetActionImpl {
|
func NewGetSubresourceAction(resource schema.GroupVersionResource, namespace, subresource, name string) GetActionImpl {
|
||||||
|
return NewGetSubresourceActionWithOptions(resource, namespace, subresource, name, metav1.GetOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetSubresourceActionWithOptions(resource schema.GroupVersionResource, namespace, subresource, name string, opts metav1.GetOptions) GetActionImpl {
|
||||||
action := GetActionImpl{}
|
action := GetActionImpl{}
|
||||||
action.Verb = "get"
|
action.Verb = "get"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Subresource = subresource
|
action.Subresource = subresource
|
||||||
action.Namespace = namespace
|
action.Namespace = namespace
|
||||||
action.Name = name
|
action.Name = name
|
||||||
|
action.GetOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRootGetSubresourceAction(resource schema.GroupVersionResource, subresource, name string) GetActionImpl {
|
func NewRootGetSubresourceAction(resource schema.GroupVersionResource, subresource, name string) GetActionImpl {
|
||||||
|
return NewRootGetSubresourceActionWithOptions(resource, subresource, name, metav1.GetOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootGetSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource, name string, opts metav1.GetOptions) GetActionImpl {
|
||||||
action := GetActionImpl{}
|
action := GetActionImpl{}
|
||||||
action.Verb = "get"
|
action.Verb = "get"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Subresource = subresource
|
action.Subresource = subresource
|
||||||
action.Name = name
|
action.Name = name
|
||||||
|
action.GetOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
@ -76,6 +96,21 @@ func NewRootListAction(resource schema.GroupVersionResource, kind schema.GroupVe
|
|||||||
action.Kind = kind
|
action.Kind = kind
|
||||||
labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
|
labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
|
||||||
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
|
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
|
||||||
|
action.ListOptions = metav1.ListOptions{LabelSelector: labelSelector.String(), FieldSelector: fieldSelector.String()}
|
||||||
|
|
||||||
|
return action
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootListActionWithOptions(resource schema.GroupVersionResource, kind schema.GroupVersionKind, opts metav1.ListOptions) ListActionImpl {
|
||||||
|
action := ListActionImpl{}
|
||||||
|
action.Verb = "list"
|
||||||
|
action.Resource = resource
|
||||||
|
action.Kind = kind
|
||||||
|
action.ListOptions = opts
|
||||||
|
|
||||||
|
labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
|
||||||
|
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
|
||||||
|
action.ListOptions = metav1.ListOptions{LabelSelector: labelSelector.String(), FieldSelector: fieldSelector.String()}
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
@ -86,6 +121,21 @@ func NewListAction(resource schema.GroupVersionResource, kind schema.GroupVersio
|
|||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Kind = kind
|
action.Kind = kind
|
||||||
action.Namespace = namespace
|
action.Namespace = namespace
|
||||||
|
labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
|
||||||
|
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
|
||||||
|
action.ListOptions = metav1.ListOptions{LabelSelector: labelSelector.String(), FieldSelector: fieldSelector.String()}
|
||||||
|
|
||||||
|
return action
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewListActionWithOptions(resource schema.GroupVersionResource, kind schema.GroupVersionKind, namespace string, opts metav1.ListOptions) ListActionImpl {
|
||||||
|
action := ListActionImpl{}
|
||||||
|
action.Verb = "list"
|
||||||
|
action.Resource = resource
|
||||||
|
action.Kind = kind
|
||||||
|
action.Namespace = namespace
|
||||||
|
action.ListOptions = opts
|
||||||
|
|
||||||
labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
|
labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
|
||||||
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
|
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
|
||||||
|
|
||||||
@ -93,36 +143,55 @@ func NewListAction(resource schema.GroupVersionResource, kind schema.GroupVersio
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewRootCreateAction(resource schema.GroupVersionResource, object runtime.Object) CreateActionImpl {
|
func NewRootCreateAction(resource schema.GroupVersionResource, object runtime.Object) CreateActionImpl {
|
||||||
|
return NewRootCreateActionWithOptions(resource, object, metav1.CreateOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootCreateActionWithOptions(resource schema.GroupVersionResource, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl {
|
||||||
action := CreateActionImpl{}
|
action := CreateActionImpl{}
|
||||||
action.Verb = "create"
|
action.Verb = "create"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Object = object
|
action.Object = object
|
||||||
|
action.CreateOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCreateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object) CreateActionImpl {
|
func NewCreateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object) CreateActionImpl {
|
||||||
|
return NewCreateActionWithOptions(resource, namespace, object, metav1.CreateOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCreateActionWithOptions(resource schema.GroupVersionResource, namespace string, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl {
|
||||||
action := CreateActionImpl{}
|
action := CreateActionImpl{}
|
||||||
action.Verb = "create"
|
action.Verb = "create"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Namespace = namespace
|
action.Namespace = namespace
|
||||||
action.Object = object
|
action.Object = object
|
||||||
|
action.CreateOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRootCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource string, object runtime.Object) CreateActionImpl {
|
func NewRootCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource string, object runtime.Object) CreateActionImpl {
|
||||||
|
return NewRootCreateSubresourceActionWithOptions(resource, name, subresource, object, metav1.CreateOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootCreateSubresourceActionWithOptions(resource schema.GroupVersionResource, name, subresource string, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl {
|
||||||
action := CreateActionImpl{}
|
action := CreateActionImpl{}
|
||||||
action.Verb = "create"
|
action.Verb = "create"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Subresource = subresource
|
action.Subresource = subresource
|
||||||
action.Name = name
|
action.Name = name
|
||||||
action.Object = object
|
action.Object = object
|
||||||
|
action.CreateOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource, namespace string, object runtime.Object) CreateActionImpl {
|
func NewCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource, namespace string, object runtime.Object) CreateActionImpl {
|
||||||
|
return NewCreateSubresourceActionWithOptions(resource, name, subresource, namespace, object, metav1.CreateOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCreateSubresourceActionWithOptions(resource schema.GroupVersionResource, name, subresource, namespace string, object runtime.Object, opts metav1.CreateOptions) CreateActionImpl {
|
||||||
action := CreateActionImpl{}
|
action := CreateActionImpl{}
|
||||||
action.Verb = "create"
|
action.Verb = "create"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
@ -130,41 +199,61 @@ func NewCreateSubresourceAction(resource schema.GroupVersionResource, name, subr
|
|||||||
action.Subresource = subresource
|
action.Subresource = subresource
|
||||||
action.Name = name
|
action.Name = name
|
||||||
action.Object = object
|
action.Object = object
|
||||||
|
action.CreateOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRootUpdateAction(resource schema.GroupVersionResource, object runtime.Object) UpdateActionImpl {
|
func NewRootUpdateAction(resource schema.GroupVersionResource, object runtime.Object) UpdateActionImpl {
|
||||||
|
return NewRootUpdateActionWithOptions(resource, object, metav1.UpdateOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootUpdateActionWithOptions(resource schema.GroupVersionResource, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl {
|
||||||
action := UpdateActionImpl{}
|
action := UpdateActionImpl{}
|
||||||
action.Verb = "update"
|
action.Verb = "update"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Object = object
|
action.Object = object
|
||||||
|
action.UpdateOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUpdateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object) UpdateActionImpl {
|
func NewUpdateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object) UpdateActionImpl {
|
||||||
|
return NewUpdateActionWithOptions(resource, namespace, object, metav1.UpdateOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUpdateActionWithOptions(resource schema.GroupVersionResource, namespace string, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl {
|
||||||
action := UpdateActionImpl{}
|
action := UpdateActionImpl{}
|
||||||
action.Verb = "update"
|
action.Verb = "update"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Namespace = namespace
|
action.Namespace = namespace
|
||||||
action.Object = object
|
action.Object = object
|
||||||
|
action.UpdateOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRootPatchAction(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte) PatchActionImpl {
|
func NewRootPatchAction(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte) PatchActionImpl {
|
||||||
|
return NewRootPatchActionWithOptions(resource, name, pt, patch, metav1.PatchOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootPatchActionWithOptions(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions) PatchActionImpl {
|
||||||
action := PatchActionImpl{}
|
action := PatchActionImpl{}
|
||||||
action.Verb = "patch"
|
action.Verb = "patch"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Name = name
|
action.Name = name
|
||||||
action.PatchType = pt
|
action.PatchType = pt
|
||||||
action.Patch = patch
|
action.Patch = patch
|
||||||
|
action.PatchOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPatchAction(resource schema.GroupVersionResource, namespace string, name string, pt types.PatchType, patch []byte) PatchActionImpl {
|
func NewPatchAction(resource schema.GroupVersionResource, namespace string, name string, pt types.PatchType, patch []byte) PatchActionImpl {
|
||||||
|
return NewPatchActionWithOptions(resource, namespace, name, pt, patch, metav1.PatchOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPatchActionWithOptions(resource schema.GroupVersionResource, namespace string, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions) PatchActionImpl {
|
||||||
action := PatchActionImpl{}
|
action := PatchActionImpl{}
|
||||||
action.Verb = "patch"
|
action.Verb = "patch"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
@ -172,11 +261,16 @@ func NewPatchAction(resource schema.GroupVersionResource, namespace string, name
|
|||||||
action.Name = name
|
action.Name = name
|
||||||
action.PatchType = pt
|
action.PatchType = pt
|
||||||
action.Patch = patch
|
action.Patch = patch
|
||||||
|
action.PatchOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRootPatchSubresourceAction(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, subresources ...string) PatchActionImpl {
|
func NewRootPatchSubresourceAction(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, subresources ...string) PatchActionImpl {
|
||||||
|
return NewRootPatchSubresourceActionWithOptions(resource, name, pt, patch, metav1.PatchOptions{}, subresources...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootPatchSubresourceActionWithOptions(resource schema.GroupVersionResource, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions, subresources ...string) PatchActionImpl {
|
||||||
action := PatchActionImpl{}
|
action := PatchActionImpl{}
|
||||||
action.Verb = "patch"
|
action.Verb = "patch"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
@ -184,11 +278,16 @@ func NewRootPatchSubresourceAction(resource schema.GroupVersionResource, name st
|
|||||||
action.Name = name
|
action.Name = name
|
||||||
action.PatchType = pt
|
action.PatchType = pt
|
||||||
action.Patch = patch
|
action.Patch = patch
|
||||||
|
action.PatchOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPatchSubresourceAction(resource schema.GroupVersionResource, namespace, name string, pt types.PatchType, patch []byte, subresources ...string) PatchActionImpl {
|
func NewPatchSubresourceAction(resource schema.GroupVersionResource, namespace, name string, pt types.PatchType, patch []byte, subresources ...string) PatchActionImpl {
|
||||||
|
return NewPatchSubresourceActionWithOptions(resource, namespace, name, pt, patch, metav1.PatchOptions{}, subresources...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPatchSubresourceActionWithOptions(resource schema.GroupVersionResource, namespace, name string, pt types.PatchType, patch []byte, opts metav1.PatchOptions, subresources ...string) PatchActionImpl {
|
||||||
action := PatchActionImpl{}
|
action := PatchActionImpl{}
|
||||||
action.Verb = "patch"
|
action.Verb = "patch"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
@ -197,26 +296,38 @@ func NewPatchSubresourceAction(resource schema.GroupVersionResource, namespace,
|
|||||||
action.Name = name
|
action.Name = name
|
||||||
action.PatchType = pt
|
action.PatchType = pt
|
||||||
action.Patch = patch
|
action.Patch = patch
|
||||||
|
action.PatchOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRootUpdateSubresourceAction(resource schema.GroupVersionResource, subresource string, object runtime.Object) UpdateActionImpl {
|
func NewRootUpdateSubresourceAction(resource schema.GroupVersionResource, subresource string, object runtime.Object) UpdateActionImpl {
|
||||||
|
return NewRootUpdateSubresourceActionWithOptions(resource, subresource, object, metav1.UpdateOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootUpdateSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource string, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl {
|
||||||
action := UpdateActionImpl{}
|
action := UpdateActionImpl{}
|
||||||
action.Verb = "update"
|
action.Verb = "update"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Subresource = subresource
|
action.Subresource = subresource
|
||||||
action.Object = object
|
action.Object = object
|
||||||
|
action.UpdateOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUpdateSubresourceAction(resource schema.GroupVersionResource, subresource string, namespace string, object runtime.Object) UpdateActionImpl {
|
func NewUpdateSubresourceAction(resource schema.GroupVersionResource, subresource string, namespace string, object runtime.Object) UpdateActionImpl {
|
||||||
|
return NewUpdateSubresourceActionWithOptions(resource, subresource, namespace, object, metav1.UpdateOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUpdateSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource string, namespace string, object runtime.Object, opts metav1.UpdateOptions) UpdateActionImpl {
|
||||||
action := UpdateActionImpl{}
|
action := UpdateActionImpl{}
|
||||||
action.Verb = "update"
|
action.Verb = "update"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Subresource = subresource
|
action.Subresource = subresource
|
||||||
action.Namespace = namespace
|
action.Namespace = namespace
|
||||||
action.Object = object
|
action.Object = object
|
||||||
|
action.UpdateOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
@ -236,11 +347,16 @@ func NewRootDeleteActionWithOptions(resource schema.GroupVersionResource, name s
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewRootDeleteSubresourceAction(resource schema.GroupVersionResource, subresource string, name string) DeleteActionImpl {
|
func NewRootDeleteSubresourceAction(resource schema.GroupVersionResource, subresource string, name string) DeleteActionImpl {
|
||||||
|
return NewRootDeleteSubresourceActionWithOptions(resource, subresource, name, metav1.DeleteOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootDeleteSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource string, name string, opts metav1.DeleteOptions) DeleteActionImpl {
|
||||||
action := DeleteActionImpl{}
|
action := DeleteActionImpl{}
|
||||||
action.Verb = "delete"
|
action.Verb = "delete"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Subresource = subresource
|
action.Subresource = subresource
|
||||||
action.Name = name
|
action.Name = name
|
||||||
|
action.DeleteOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
@ -261,41 +377,69 @@ func NewDeleteActionWithOptions(resource schema.GroupVersionResource, namespace,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewDeleteSubresourceAction(resource schema.GroupVersionResource, subresource, namespace, name string) DeleteActionImpl {
|
func NewDeleteSubresourceAction(resource schema.GroupVersionResource, subresource, namespace, name string) DeleteActionImpl {
|
||||||
|
return NewDeleteSubresourceActionWithOptions(resource, subresource, namespace, name, metav1.DeleteOptions{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDeleteSubresourceActionWithOptions(resource schema.GroupVersionResource, subresource, namespace, name string, opts metav1.DeleteOptions) DeleteActionImpl {
|
||||||
action := DeleteActionImpl{}
|
action := DeleteActionImpl{}
|
||||||
action.Verb = "delete"
|
action.Verb = "delete"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Subresource = subresource
|
action.Subresource = subresource
|
||||||
action.Namespace = namespace
|
action.Namespace = namespace
|
||||||
action.Name = name
|
action.Name = name
|
||||||
|
action.DeleteOptions = opts
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRootDeleteCollectionAction(resource schema.GroupVersionResource, opts interface{}) DeleteCollectionActionImpl {
|
func NewRootDeleteCollectionAction(resource schema.GroupVersionResource, opts interface{}) DeleteCollectionActionImpl {
|
||||||
|
listOpts, _ := opts.(metav1.ListOptions)
|
||||||
|
return NewRootDeleteCollectionActionWithOptions(resource, metav1.DeleteOptions{}, listOpts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootDeleteCollectionActionWithOptions(resource schema.GroupVersionResource, deleteOpts metav1.DeleteOptions, listOpts metav1.ListOptions) DeleteCollectionActionImpl {
|
||||||
action := DeleteCollectionActionImpl{}
|
action := DeleteCollectionActionImpl{}
|
||||||
action.Verb = "delete-collection"
|
action.Verb = "delete-collection"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
|
action.DeleteOptions = deleteOpts
|
||||||
|
action.ListOptions = listOpts
|
||||||
|
|
||||||
|
labelSelector, fieldSelector, _ := ExtractFromListOptions(listOpts)
|
||||||
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
|
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDeleteCollectionAction(resource schema.GroupVersionResource, namespace string, opts interface{}) DeleteCollectionActionImpl {
|
func NewDeleteCollectionAction(resource schema.GroupVersionResource, namespace string, opts interface{}) DeleteCollectionActionImpl {
|
||||||
|
listOpts, _ := opts.(metav1.ListOptions)
|
||||||
|
return NewDeleteCollectionActionWithOptions(resource, namespace, metav1.DeleteOptions{}, listOpts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDeleteCollectionActionWithOptions(resource schema.GroupVersionResource, namespace string, deleteOpts metav1.DeleteOptions, listOpts metav1.ListOptions) DeleteCollectionActionImpl {
|
||||||
action := DeleteCollectionActionImpl{}
|
action := DeleteCollectionActionImpl{}
|
||||||
action.Verb = "delete-collection"
|
action.Verb = "delete-collection"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Namespace = namespace
|
action.Namespace = namespace
|
||||||
labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
|
action.DeleteOptions = deleteOpts
|
||||||
|
action.ListOptions = listOpts
|
||||||
|
|
||||||
|
labelSelector, fieldSelector, _ := ExtractFromListOptions(listOpts)
|
||||||
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
|
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
|
||||||
|
|
||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRootWatchAction(resource schema.GroupVersionResource, opts interface{}) WatchActionImpl {
|
func NewRootWatchAction(resource schema.GroupVersionResource, opts interface{}) WatchActionImpl {
|
||||||
|
listOpts, _ := opts.(metav1.ListOptions)
|
||||||
|
return NewRootWatchActionWithOptions(resource, listOpts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRootWatchActionWithOptions(resource schema.GroupVersionResource, opts metav1.ListOptions) WatchActionImpl {
|
||||||
action := WatchActionImpl{}
|
action := WatchActionImpl{}
|
||||||
action.Verb = "watch"
|
action.Verb = "watch"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
|
action.ListOptions = opts
|
||||||
|
|
||||||
labelSelector, fieldSelector, resourceVersion := ExtractFromListOptions(opts)
|
labelSelector, fieldSelector, resourceVersion := ExtractFromListOptions(opts)
|
||||||
action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, resourceVersion}
|
action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, resourceVersion}
|
||||||
|
|
||||||
@ -328,10 +472,17 @@ func ExtractFromListOptions(opts interface{}) (labelSelector labels.Selector, fi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewWatchAction(resource schema.GroupVersionResource, namespace string, opts interface{}) WatchActionImpl {
|
func NewWatchAction(resource schema.GroupVersionResource, namespace string, opts interface{}) WatchActionImpl {
|
||||||
|
listOpts, _ := opts.(metav1.ListOptions)
|
||||||
|
return NewWatchActionWithOptions(resource, namespace, listOpts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWatchActionWithOptions(resource schema.GroupVersionResource, namespace string, opts metav1.ListOptions) WatchActionImpl {
|
||||||
action := WatchActionImpl{}
|
action := WatchActionImpl{}
|
||||||
action.Verb = "watch"
|
action.Verb = "watch"
|
||||||
action.Resource = resource
|
action.Resource = resource
|
||||||
action.Namespace = namespace
|
action.Namespace = namespace
|
||||||
|
action.ListOptions = opts
|
||||||
|
|
||||||
labelSelector, fieldSelector, resourceVersion := ExtractFromListOptions(opts)
|
labelSelector, fieldSelector, resourceVersion := ExtractFromListOptions(opts)
|
||||||
action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, resourceVersion}
|
action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, resourceVersion}
|
||||||
|
|
||||||
@ -487,17 +638,23 @@ func (a GenericActionImpl) DeepCopy() Action {
|
|||||||
|
|
||||||
type GetActionImpl struct {
|
type GetActionImpl struct {
|
||||||
ActionImpl
|
ActionImpl
|
||||||
Name string
|
Name string
|
||||||
|
GetOptions metav1.GetOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a GetActionImpl) GetName() string {
|
func (a GetActionImpl) GetName() string {
|
||||||
return a.Name
|
return a.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a GetActionImpl) GetGetOptions() metav1.GetOptions {
|
||||||
|
return a.GetOptions
|
||||||
|
}
|
||||||
|
|
||||||
func (a GetActionImpl) DeepCopy() Action {
|
func (a GetActionImpl) DeepCopy() Action {
|
||||||
return GetActionImpl{
|
return GetActionImpl{
|
||||||
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
||||||
Name: a.Name,
|
Name: a.Name,
|
||||||
|
GetOptions: *a.GetOptions.DeepCopy(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,6 +663,7 @@ type ListActionImpl struct {
|
|||||||
Kind schema.GroupVersionKind
|
Kind schema.GroupVersionKind
|
||||||
Name string
|
Name string
|
||||||
ListRestrictions ListRestrictions
|
ListRestrictions ListRestrictions
|
||||||
|
ListOptions metav1.ListOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a ListActionImpl) GetKind() schema.GroupVersionKind {
|
func (a ListActionImpl) GetKind() schema.GroupVersionKind {
|
||||||
@ -516,6 +674,10 @@ func (a ListActionImpl) GetListRestrictions() ListRestrictions {
|
|||||||
return a.ListRestrictions
|
return a.ListRestrictions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a ListActionImpl) GetListOptions() metav1.ListOptions {
|
||||||
|
return a.ListOptions
|
||||||
|
}
|
||||||
|
|
||||||
func (a ListActionImpl) DeepCopy() Action {
|
func (a ListActionImpl) DeepCopy() Action {
|
||||||
return ListActionImpl{
|
return ListActionImpl{
|
||||||
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
||||||
@ -525,48 +687,62 @@ func (a ListActionImpl) DeepCopy() Action {
|
|||||||
Labels: a.ListRestrictions.Labels.DeepCopySelector(),
|
Labels: a.ListRestrictions.Labels.DeepCopySelector(),
|
||||||
Fields: a.ListRestrictions.Fields.DeepCopySelector(),
|
Fields: a.ListRestrictions.Fields.DeepCopySelector(),
|
||||||
},
|
},
|
||||||
|
ListOptions: *a.ListOptions.DeepCopy(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateActionImpl struct {
|
type CreateActionImpl struct {
|
||||||
ActionImpl
|
ActionImpl
|
||||||
Name string
|
Name string
|
||||||
Object runtime.Object
|
Object runtime.Object
|
||||||
|
CreateOptions metav1.CreateOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a CreateActionImpl) GetObject() runtime.Object {
|
func (a CreateActionImpl) GetObject() runtime.Object {
|
||||||
return a.Object
|
return a.Object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a CreateActionImpl) GetCreateOptions() metav1.CreateOptions {
|
||||||
|
return a.CreateOptions
|
||||||
|
}
|
||||||
|
|
||||||
func (a CreateActionImpl) DeepCopy() Action {
|
func (a CreateActionImpl) DeepCopy() Action {
|
||||||
return CreateActionImpl{
|
return CreateActionImpl{
|
||||||
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
||||||
Name: a.Name,
|
Name: a.Name,
|
||||||
Object: a.Object.DeepCopyObject(),
|
Object: a.Object.DeepCopyObject(),
|
||||||
|
CreateOptions: *a.CreateOptions.DeepCopy(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateActionImpl struct {
|
type UpdateActionImpl struct {
|
||||||
ActionImpl
|
ActionImpl
|
||||||
Object runtime.Object
|
Object runtime.Object
|
||||||
|
UpdateOptions metav1.UpdateOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a UpdateActionImpl) GetObject() runtime.Object {
|
func (a UpdateActionImpl) GetObject() runtime.Object {
|
||||||
return a.Object
|
return a.Object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a UpdateActionImpl) GetUpdateOptions() metav1.UpdateOptions {
|
||||||
|
return a.UpdateOptions
|
||||||
|
}
|
||||||
|
|
||||||
func (a UpdateActionImpl) DeepCopy() Action {
|
func (a UpdateActionImpl) DeepCopy() Action {
|
||||||
return UpdateActionImpl{
|
return UpdateActionImpl{
|
||||||
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
||||||
Object: a.Object.DeepCopyObject(),
|
Object: a.Object.DeepCopyObject(),
|
||||||
|
UpdateOptions: *a.UpdateOptions.DeepCopy(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type PatchActionImpl struct {
|
type PatchActionImpl struct {
|
||||||
ActionImpl
|
ActionImpl
|
||||||
Name string
|
Name string
|
||||||
PatchType types.PatchType
|
PatchType types.PatchType
|
||||||
Patch []byte
|
Patch []byte
|
||||||
|
PatchOptions metav1.PatchOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a PatchActionImpl) GetName() string {
|
func (a PatchActionImpl) GetName() string {
|
||||||
@ -581,14 +757,19 @@ func (a PatchActionImpl) GetPatchType() types.PatchType {
|
|||||||
return a.PatchType
|
return a.PatchType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a PatchActionImpl) GetPatchOptions() metav1.PatchOptions {
|
||||||
|
return a.PatchOptions
|
||||||
|
}
|
||||||
|
|
||||||
func (a PatchActionImpl) DeepCopy() Action {
|
func (a PatchActionImpl) DeepCopy() Action {
|
||||||
patch := make([]byte, len(a.Patch))
|
patch := make([]byte, len(a.Patch))
|
||||||
copy(patch, a.Patch)
|
copy(patch, a.Patch)
|
||||||
return PatchActionImpl{
|
return PatchActionImpl{
|
||||||
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
||||||
Name: a.Name,
|
Name: a.Name,
|
||||||
PatchType: a.PatchType,
|
PatchType: a.PatchType,
|
||||||
Patch: patch,
|
Patch: patch,
|
||||||
|
PatchOptions: *a.PatchOptions.DeepCopy(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,12 +798,22 @@ func (a DeleteActionImpl) DeepCopy() Action {
|
|||||||
type DeleteCollectionActionImpl struct {
|
type DeleteCollectionActionImpl struct {
|
||||||
ActionImpl
|
ActionImpl
|
||||||
ListRestrictions ListRestrictions
|
ListRestrictions ListRestrictions
|
||||||
|
DeleteOptions metav1.DeleteOptions
|
||||||
|
ListOptions metav1.ListOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a DeleteCollectionActionImpl) GetListRestrictions() ListRestrictions {
|
func (a DeleteCollectionActionImpl) GetListRestrictions() ListRestrictions {
|
||||||
return a.ListRestrictions
|
return a.ListRestrictions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a DeleteCollectionActionImpl) GetDeleteOptions() metav1.DeleteOptions {
|
||||||
|
return a.DeleteOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a DeleteCollectionActionImpl) GetListOptions() metav1.ListOptions {
|
||||||
|
return a.ListOptions
|
||||||
|
}
|
||||||
|
|
||||||
func (a DeleteCollectionActionImpl) DeepCopy() Action {
|
func (a DeleteCollectionActionImpl) DeepCopy() Action {
|
||||||
return DeleteCollectionActionImpl{
|
return DeleteCollectionActionImpl{
|
||||||
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
||||||
@ -630,18 +821,25 @@ func (a DeleteCollectionActionImpl) DeepCopy() Action {
|
|||||||
Labels: a.ListRestrictions.Labels.DeepCopySelector(),
|
Labels: a.ListRestrictions.Labels.DeepCopySelector(),
|
||||||
Fields: a.ListRestrictions.Fields.DeepCopySelector(),
|
Fields: a.ListRestrictions.Fields.DeepCopySelector(),
|
||||||
},
|
},
|
||||||
|
DeleteOptions: *a.DeleteOptions.DeepCopy(),
|
||||||
|
ListOptions: *a.ListOptions.DeepCopy(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type WatchActionImpl struct {
|
type WatchActionImpl struct {
|
||||||
ActionImpl
|
ActionImpl
|
||||||
WatchRestrictions WatchRestrictions
|
WatchRestrictions WatchRestrictions
|
||||||
|
ListOptions metav1.ListOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a WatchActionImpl) GetWatchRestrictions() WatchRestrictions {
|
func (a WatchActionImpl) GetWatchRestrictions() WatchRestrictions {
|
||||||
return a.WatchRestrictions
|
return a.WatchRestrictions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a WatchActionImpl) GetListOptions() metav1.ListOptions {
|
||||||
|
return a.ListOptions
|
||||||
|
}
|
||||||
|
|
||||||
func (a WatchActionImpl) DeepCopy() Action {
|
func (a WatchActionImpl) DeepCopy() Action {
|
||||||
return WatchActionImpl{
|
return WatchActionImpl{
|
||||||
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
ActionImpl: a.ActionImpl.DeepCopy().(ActionImpl),
|
||||||
@ -650,6 +848,7 @@ func (a WatchActionImpl) DeepCopy() Action {
|
|||||||
Fields: a.WatchRestrictions.Fields.DeepCopySelector(),
|
Fields: a.WatchRestrictions.Fields.DeepCopySelector(),
|
||||||
ResourceVersion: a.WatchRestrictions.ResourceVersion,
|
ResourceVersion: a.WatchRestrictions.ResourceVersion,
|
||||||
},
|
},
|
||||||
|
ListOptions: *a.ListOptions.DeepCopy(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user