Merge pull request #27293 from caesarxuchao/add-patch-to-clientset
Automatic merge from submit-queue [client-gen]Add Patch to clientset * add the Patch() method to the clientset. * I have to rename the existing Patch() method of `Event` to PatchWithEventNamespace() to avoid overriding. * some minor changes to the fake Patch action. cc @Random-Liu since he asked for the method @kubernetes/sig-api-machinery ref #26580 ```release-note Add the Patch method to the generated clientset. ```
This commit is contained in:
@@ -118,21 +118,23 @@ func NewUpdateAction(resource unversioned.GroupVersionResource, namespace string
|
||||
return action
|
||||
}
|
||||
|
||||
func NewRootPatchAction(resource unversioned.GroupVersionResource, object runtime.Object) PatchActionImpl {
|
||||
func NewRootPatchAction(resource unversioned.GroupVersionResource, name string, patch []byte) PatchActionImpl {
|
||||
action := PatchActionImpl{}
|
||||
action.Verb = "patch"
|
||||
action.Resource = resource
|
||||
action.Object = object
|
||||
action.Name = name
|
||||
action.Patch = patch
|
||||
|
||||
return action
|
||||
}
|
||||
|
||||
func NewPatchAction(resource unversioned.GroupVersionResource, namespace string, object runtime.Object) PatchActionImpl {
|
||||
func NewPatchAction(resource unversioned.GroupVersionResource, namespace string, name string, patch []byte) PatchActionImpl {
|
||||
action := PatchActionImpl{}
|
||||
action.Verb = "patch"
|
||||
action.Resource = resource
|
||||
action.Namespace = namespace
|
||||
action.Object = object
|
||||
action.Name = name
|
||||
action.Patch = patch
|
||||
|
||||
return action
|
||||
}
|
||||
@@ -401,11 +403,16 @@ func (a UpdateActionImpl) GetObject() runtime.Object {
|
||||
|
||||
type PatchActionImpl struct {
|
||||
ActionImpl
|
||||
Object runtime.Object
|
||||
Name string
|
||||
Patch []byte
|
||||
}
|
||||
|
||||
func (a PatchActionImpl) GetObject() runtime.Object {
|
||||
return a.Object
|
||||
func (a PatchActionImpl) GetName() string {
|
||||
return a.Name
|
||||
}
|
||||
|
||||
func (a PatchActionImpl) GetPatch() []byte {
|
||||
return a.Patch
|
||||
}
|
||||
|
||||
type DeleteActionImpl struct {
|
||||
|
Reference in New Issue
Block a user