@@ -18,19 +18,23 @@ limitations under the License.
1818package fake
1919
2020import (
21- "k8s.io/api/core/v1"
21+ v1 "k8s.io/api/core/v1"
2222 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323 "k8s.io/apimachinery/pkg/fields"
2424 "k8s.io/apimachinery/pkg/runtime"
25+ "k8s.io/apimachinery/pkg/runtime/schema"
2526 "k8s.io/apimachinery/pkg/types"
2627
2728 core "github.com/kcp-dev/client-go/third_party/k8s.io/client-go/testing"
2829)
2930
30- func (c * eventsClient ) CreateWithEventNamespace (event * v1.Event ) (* v1.Event , error ) {
31+ var eventsResource = schema.GroupVersionResource {Group : "events.k8s.io" , Version : "v1beta1" , Resource : "events" }
32+ var eventsKind = schema.GroupVersionKind {Group : "events.k8s.io" , Version : "v1beta1" , Kind : "Event" }
33+
34+ func (c * eventScopedClient ) CreateWithEventNamespace (event * v1.Event ) (* v1.Event , error ) {
3135 action := core .NewRootCreateAction (eventsResource , c .ClusterPath , event )
32- if c .Namespace != "" {
33- action = core .NewCreateAction (eventsResource , c .ClusterPath , c .Namespace , event )
36+ if c .Namespace () != "" {
37+ action = core .NewCreateAction (eventsResource , c .ClusterPath , c .Namespace () , event )
3438 }
3539 obj , err := c .Fake .Invokes (action , event )
3640 if obj == nil {
@@ -41,10 +45,10 @@ func (c *eventsClient) CreateWithEventNamespace(event *v1.Event) (*v1.Event, err
4145}
4246
4347// Update replaces an existing event. Returns the copy of the event the server returns, or an error.
44- func (c * eventsClient ) UpdateWithEventNamespace (event * v1.Event ) (* v1.Event , error ) {
48+ func (c * eventScopedClient ) UpdateWithEventNamespace (event * v1.Event ) (* v1.Event , error ) {
4549 action := core .NewRootUpdateAction (eventsResource , c .ClusterPath , event )
46- if c .Namespace != "" {
47- action = core .NewUpdateAction (eventsResource , c .ClusterPath , c .Namespace , event )
50+ if c .Namespace () != "" {
51+ action = core .NewUpdateAction (eventsResource , c .ClusterPath , c .Namespace () , event )
4852 }
4953 obj , err := c .Fake .Invokes (action , event )
5054 if obj == nil {
@@ -56,12 +60,12 @@ func (c *eventsClient) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, err
5660
5761// PatchWithEventNamespace patches an existing event. Returns the copy of the event the server returns, or an error.
5862// TODO: Should take a PatchType as an argument probably.
59- func (c * eventsClient ) PatchWithEventNamespace (event * v1.Event , data []byte ) (* v1.Event , error ) {
63+ func (c * eventScopedClient ) PatchWithEventNamespace (event * v1.Event , data []byte ) (* v1.Event , error ) {
6064 // TODO: Should be configurable to support additional patch strategies.
6165 pt := types .StrategicMergePatchType
6266 action := core .NewRootPatchAction (eventsResource , c .ClusterPath , event .Name , pt , data )
63- if c .Namespace != "" {
64- action = core .NewPatchAction (eventsResource , c .ClusterPath , c .Namespace , event .Name , pt , data )
67+ if c .Namespace () != "" {
68+ action = core .NewPatchAction (eventsResource , c .ClusterPath , c .Namespace () , event .Name , pt , data )
6569 }
6670 obj , err := c .Fake .Invokes (action , event )
6771 if obj == nil {
@@ -72,10 +76,10 @@ func (c *eventsClient) PatchWithEventNamespace(event *v1.Event, data []byte) (*v
7276}
7377
7478// Search returns a list of events matching the specified object.
75- func (c * eventsClient ) Search (scheme * runtime.Scheme , objOrRef runtime.Object ) (* v1.EventList , error ) {
79+ func (c * eventScopedClient ) Search (scheme * runtime.Scheme , objOrRef runtime.Object ) (* v1.EventList , error ) {
7680 action := core .NewRootListAction (eventsResource , eventsKind , c .ClusterPath , metav1.ListOptions {})
77- if c .Namespace != "" {
78- action = core .NewListAction (eventsResource , eventsKind , c .ClusterPath , c .Namespace , metav1.ListOptions {})
81+ if c .Namespace () != "" {
82+ action = core .NewListAction (eventsResource , eventsKind , c .ClusterPath , c .Namespace () , metav1.ListOptions {})
7983 }
8084 obj , err := c .Fake .Invokes (action , & v1.EventList {})
8185 if obj == nil {
@@ -85,7 +89,7 @@ func (c *eventsClient) Search(scheme *runtime.Scheme, objOrRef runtime.Object) (
8589 return obj .(* v1.EventList ), err
8690}
8791
88- func (c * eventsClient ) GetFieldSelector (involvedObjectName , involvedObjectNamespace , involvedObjectKind , involvedObjectUID * string ) fields.Selector {
92+ func (c * eventScopedClient ) GetFieldSelector (involvedObjectName , involvedObjectNamespace , involvedObjectKind , involvedObjectUID * string ) fields.Selector {
8993 action := core.GenericActionImpl {}
9094 action .Verb = "get-field-selector"
9195 action .Resource = eventsResource
0 commit comments