@@ -31,13 +31,29 @@ import (
31
31
// The EventExpansion interface allows manually adding extra methods to the EventInterface.
32
32
type EventExpansion interface {
33
33
// CreateWithEventNamespace is the same as a Create, except that it sends the request to the event.Namespace.
34
+ //
35
+ // Deprecated: use [CreateWithEventNamespaceWithContext] instead.
34
36
CreateWithEventNamespace (event * v1.Event ) (* v1.Event , error )
35
37
// UpdateWithEventNamespace is the same as a Update, except that it sends the request to the event.Namespace.
38
+ //
39
+ // Deprecated: use [UpdateWithEventNamespaceWithContext] instead.
36
40
UpdateWithEventNamespace (event * v1.Event ) (* v1.Event , error )
37
41
// PatchWithEventNamespace is the same as a Patch, except that it sends the request to the event.Namespace.
42
+ //
43
+ // Deprecated: use [PatchWithEventNamespaceWithContext] instead.
38
44
PatchWithEventNamespace (event * v1.Event , data []byte ) (* v1.Event , error )
39
45
// Search finds events about the specified object
46
+ //
47
+ // Deprecated: use [SearchWithContext] instead.
40
48
Search (scheme * runtime.Scheme , objOrRef runtime.Object ) (* v1.EventList , error )
49
+ // CreateWithEventNamespaceWithContext is the same as a Create, except that it sends the request to the event.Namespace.
50
+ CreateWithEventNamespaceWithContext (ctx context.Context , event * v1.Event ) (* v1.Event , error )
51
+ // UpdateWithEventNamespaceWithContext is the same as a Update, except that it sends the request to the event.Namespace.
52
+ UpdateWithEventNamespaceWithContext (ctx context.Context , event * v1.Event ) (* v1.Event , error )
53
+ // PatchWithEventNamespaceWithContext is the same as a Patch, except that it sends the request to the event.Namespace.
54
+ PatchWithEventNamespaceWithContext (ctx context.Context , event * v1.Event , data []byte ) (* v1.Event , error )
55
+ // SearchWithContext finds events about the specified object
56
+ SearchWithContext (ctx context.Context , scheme * runtime.Scheme , objOrRef runtime.Object ) (* v1.EventList , error )
41
57
// Returns the appropriate field selector based on the API version being used to communicate with the server.
42
58
// The returned field selector can be used with List and Watch to filter desired events.
43
59
GetFieldSelector (involvedObjectName , involvedObjectNamespace , involvedObjectKind , involvedObjectUID * string ) fields.Selector
@@ -47,7 +63,17 @@ type EventExpansion interface {
47
63
// or an error. The namespace to create the event within is deduced from the
48
64
// event; it must either match this event client's namespace, or this event
49
65
// client must have been created with the "" namespace.
66
+ //
67
+ // Deprecated: use [CreateWithEventNamespaceWithContext] instead.
50
68
func (e * events ) CreateWithEventNamespace (event * v1.Event ) (* v1.Event , error ) {
69
+ return e .CreateWithEventNamespaceWithContext (context .Background (), event )
70
+ }
71
+
72
+ // CreateWithEventNamespaceWithContext makes a new event. Returns the copy of the event the server returns,
73
+ // or an error. The namespace to create the event within is deduced from the
74
+ // event; it must either match this event client's namespace, or this event
75
+ // client must have been created with the "" namespace.
76
+ func (e * events ) CreateWithEventNamespaceWithContext (ctx context.Context , event * v1.Event ) (* v1.Event , error ) {
51
77
if e .GetNamespace () != "" && event .Namespace != e .GetNamespace () {
52
78
return nil , fmt .Errorf ("can't create an event with namespace '%v' in namespace '%v'" , event .Namespace , e .GetNamespace ())
53
79
}
@@ -56,7 +82,7 @@ func (e *events) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
56
82
NamespaceIfScoped (event .Namespace , len (event .Namespace ) > 0 ).
57
83
Resource ("events" ).
58
84
Body (event ).
59
- Do (context . TODO () ).
85
+ Do (ctx ).
60
86
Into (result )
61
87
return result , err
62
88
}
@@ -66,7 +92,18 @@ func (e *events) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
66
92
// namespace must either match this event client's namespace, or this event client must have been
67
93
// created with the "" namespace. Update also requires the ResourceVersion to be set in the event
68
94
// object.
95
+ //
96
+ // Deprecated: use [UpdateWithEventNamespaceWithContext] instead.
69
97
func (e * events ) UpdateWithEventNamespace (event * v1.Event ) (* v1.Event , error ) {
98
+ return e .UpdateWithEventNamespaceWithContext (context .Background (), event )
99
+ }
100
+
101
+ // UpdateWithEventNamespaceWithContext modifies an existing event. It returns the copy of the event that the server returns,
102
+ // or an error. The namespace and key to update the event within is deduced from the event. The
103
+ // namespace must either match this event client's namespace, or this event client must have been
104
+ // created with the "" namespace. Update also requires the ResourceVersion to be set in the event
105
+ // object.
106
+ func (e * events ) UpdateWithEventNamespaceWithContext (ctx context.Context , event * v1.Event ) (* v1.Event , error ) {
70
107
if e .GetNamespace () != "" && event .Namespace != e .GetNamespace () {
71
108
return nil , fmt .Errorf ("can't update an event with namespace '%v' in namespace '%v'" , event .Namespace , e .GetNamespace ())
72
109
}
@@ -76,7 +113,7 @@ func (e *events) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
76
113
Resource ("events" ).
77
114
Name (event .Name ).
78
115
Body (event ).
79
- Do (context . TODO () ).
116
+ Do (ctx ).
80
117
Into (result )
81
118
return result , err
82
119
}
@@ -86,7 +123,18 @@ func (e *events) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
86
123
// target event is deduced from the incompleteEvent. The namespace must either
87
124
// match this event client's namespace, or this event client must have been
88
125
// created with the "" namespace.
126
+ //
127
+ // Deprecated: use [PatchWithEventNamespaceWithContext] instead.
89
128
func (e * events ) PatchWithEventNamespace (incompleteEvent * v1.Event , data []byte ) (* v1.Event , error ) {
129
+ return e .PatchWithEventNamespaceWithContext (context .Background (), incompleteEvent , data )
130
+ }
131
+
132
+ // PatchWithEventNamespaceWithContext modifies an existing event. It returns the copy of
133
+ // the event that the server returns, or an error. The namespace and name of the
134
+ // target event is deduced from the incompleteEvent. The namespace must either
135
+ // match this event client's namespace, or this event client must have been
136
+ // created with the "" namespace.
137
+ func (e * events ) PatchWithEventNamespaceWithContext (ctx context.Context , incompleteEvent * v1.Event , data []byte ) (* v1.Event , error ) {
90
138
if e .GetNamespace () != "" && incompleteEvent .Namespace != e .GetNamespace () {
91
139
return nil , fmt .Errorf ("can't patch an event with namespace '%v' in namespace '%v'" , incompleteEvent .Namespace , e .GetNamespace ())
92
140
}
@@ -96,15 +144,24 @@ func (e *events) PatchWithEventNamespace(incompleteEvent *v1.Event, data []byte)
96
144
Resource ("events" ).
97
145
Name (incompleteEvent .Name ).
98
146
Body (data ).
99
- Do (context . TODO () ).
147
+ Do (ctx ).
100
148
Into (result )
101
149
return result , err
102
150
}
103
151
104
152
// Search finds events about the specified object. The namespace of the
105
153
// object must match this event's client namespace unless the event client
106
154
// was made with the "" namespace.
155
+ //
156
+ // Deprecated: use [SearchWithContext] instead.
107
157
func (e * events ) Search (scheme * runtime.Scheme , objOrRef runtime.Object ) (* v1.EventList , error ) {
158
+ return e .SearchWithContext (context .Background (), scheme , objOrRef )
159
+ }
160
+
161
+ // SearchWithContext finds events about the specified object. The namespace of the
162
+ // object must match this event's client namespace unless the event client
163
+ // was made with the "" namespace.
164
+ func (e * events ) SearchWithContext (ctx context.Context , scheme * runtime.Scheme , objOrRef runtime.Object ) (* v1.EventList , error ) {
108
165
ref , err := ref .GetReference (scheme , objOrRef )
109
166
if err != nil {
110
167
return nil , err
@@ -123,7 +180,7 @@ func (e *events) Search(scheme *runtime.Scheme, objOrRef runtime.Object) (*v1.Ev
123
180
refUID = & stringRefUID
124
181
}
125
182
fieldSelector := e .GetFieldSelector (& ref .Name , & ref .Namespace , refKind , refUID )
126
- return e .List (context . TODO () , metav1.ListOptions {FieldSelector : fieldSelector .String ()})
183
+ return e .List (ctx , metav1.ListOptions {FieldSelector : fieldSelector .String ()})
127
184
}
128
185
129
186
// Returns the appropriate field selector based on the API version being used to communicate with the server.
0 commit comments