Add a non-subresource genclient:method example
Extension methods on the main resource are supported by client-gen, but unused in k/k; to detect regressions in future changes to client-gen, add a minimal example (this should be turned into a proper test). Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
		@@ -19,6 +19,7 @@ package v1
 | 
				
			|||||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
					import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// +genclient
 | 
					// +genclient
 | 
				
			||||||
 | 
					// +genclient:method=GetClusterTestType,verb=get
 | 
				
			||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 | 
					// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TestType is a top-level type. A client is created for it.
 | 
					// TestType is a top-level type. A client is created for it.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -195,3 +195,14 @@ func (c *FakeTestTypes) ApplyStatus(ctx context.Context, testType *examplev1.Tes
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	return obj.(*v1.TestType), err
 | 
						return obj.(*v1.TestType), err
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GetClusterTestType takes name of the testType, and returns the corresponding testType object, and an error if there is any.
 | 
				
			||||||
 | 
					func (c *FakeTestTypes) GetClusterTestType(ctx context.Context, name string, options metav1.GetOptions) (result *v1.TestType, err error) {
 | 
				
			||||||
 | 
						obj, err := c.Fake.
 | 
				
			||||||
 | 
							Invokes(testing.NewGetAction(testtypesResource, c.ns, name), &v1.TestType{})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if obj == nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return obj.(*v1.TestType), err
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,6 +55,8 @@ type TestTypeInterface interface {
 | 
				
			|||||||
	Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error)
 | 
						Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.TestType, err error)
 | 
				
			||||||
	Apply(ctx context.Context, testType *examplev1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error)
 | 
						Apply(ctx context.Context, testType *examplev1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error)
 | 
				
			||||||
	ApplyStatus(ctx context.Context, testType *examplev1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error)
 | 
						ApplyStatus(ctx context.Context, testType *examplev1.TestTypeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.TestType, err error)
 | 
				
			||||||
 | 
						GetClusterTestType(ctx context.Context, name string, opts metav1.GetOptions) (*v1.TestType, error)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TestTypeExpansion
 | 
						TestTypeExpansion
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user