@@ -115,6 +115,34 @@ public async Task<T> ReplaceNamespacedAsync<T>(T obj, string ns, string name, Ca
115115 return KubernetesJson . Deserialize < T > ( resp . Body . ToString ( ) ) ;
116116 }
117117
118+ public IAsyncEnumerable < ( WatchEventType , T ) > WatchAsync < T > ( Action < Exception > onError = null , CancellationToken cancel = default )
119+ where T : IKubernetesObject
120+ {
121+ var respTask = kubernetes . CustomObjects . ListClusterCustomObjectWithHttpMessagesAsync ( group , version , plural , watch : true , cancellationToken : cancel ) ;
122+ return respTask . WatchAsync < T , object > ( ) ;
123+ }
124+
125+ public IAsyncEnumerable < ( WatchEventType , T ) > WatchNamespacedAsync < T > ( string ns , Action < Exception > onError = null , CancellationToken cancel = default )
126+ where T : IKubernetesObject
127+ {
128+ var respTask = kubernetes . CustomObjects . ListNamespacedCustomObjectWithHttpMessagesAsync ( group , version , ns , plural , watch : true , cancellationToken : cancel ) ;
129+ return respTask . WatchAsync < T , object > ( ) ;
130+ }
131+
132+ public Watcher < T > Watch < T > ( Action < WatchEventType , T > onEvent , Action < Exception > onError = null , Action onClosed = null )
133+ where T : IKubernetesObject
134+ {
135+ var respTask = kubernetes . CustomObjects . ListClusterCustomObjectWithHttpMessagesAsync ( group , version , plural , watch : true ) ;
136+ return respTask . Watch ( onEvent , onError , onClosed ) ;
137+ }
138+
139+ public Watcher < T > WatchNamespaced < T > ( string ns , Action < WatchEventType , T > onEvent , Action < Exception > onError = null , Action onClosed = null )
140+ where T : IKubernetesObject
141+ {
142+ var respTask = kubernetes . CustomObjects . ListNamespacedCustomObjectWithHttpMessagesAsync ( group , version , ns , plural , watch : true ) ;
143+ return respTask . Watch ( onEvent , onError , onClosed ) ;
144+ }
145+
118146 public void Dispose ( )
119147 {
120148 Dispose ( true ) ;
0 commit comments