@@ -92,7 +92,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.auth</code></h1>
9292 self.server = server
9393 self.skip_tls = skip_tls
9494
95- def login(self):
95+ def login(self) -> str :
9696 """
9797 This function is used to login to an OpenShift cluster using the user's API token and API server address.
9898 Depending on the cluster, a user can choose to login in with "--insecure-skip-tls-verify` by setting `skip_tls`
@@ -107,15 +107,18 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.auth</code></h1>
107107 error_msg = osp.result.err()
108108 if "The server uses a certificate signed by unknown authority" in error_msg:
109109 return "Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication"
110+ elif "invalid" in error_msg:
111+ raise PermissionError(error_msg)
110112 else:
111113 return error_msg
112114 return response.out()
113115
114- def logout(self):
116+ def logout(self) -> str :
115117 """
116118 This function is used to logout of an OpenShift cluster.
117119 """
118- response = oc.invoke("logout")
120+ args = [f"--token={self.token}", f"--server={self.server}:6443"]
121+ response = oc.invoke("logout", args)
119122 return response.out()
120123
121124
@@ -137,14 +140,14 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.auth</code></h1>
137140 self.username = username
138141 self.password = password
139142
140- def login(self):
143+ def login(self) -> str :
141144 """
142145 This function is used to login to an OpenShift cluster using the user's `username` and `password`.
143146 """
144147 response = oc.login(self.username, self.password)
145148 return response.out()
146149
147- def logout(self):
150+ def logout(self) -> str :
148151 """
149152 This function is used to logout of an OpenShift cluster.
150153 """
@@ -261,14 +264,14 @@ <h3>Methods</h3>
261264 self.username = username
262265 self.password = password
263266
264- def login(self):
267+ def login(self) -> str :
265268 """
266269 This function is used to login to an OpenShift cluster using the user's `username` and `password`.
267270 """
268271 response = oc.login(self.username, self.password)
269272 return response.out()
270273
271- def logout(self):
274+ def logout(self) -> str :
272275 """
273276 This function is used to logout of an OpenShift cluster.
274277 """
@@ -282,15 +285,15 @@ <h3>Ancestors</h3>
282285< h3 > Methods</ h3 >
283286< dl >
284287< dt id ="codeflare_sdk.cluster.auth.PasswordUserAuthentication.login "> < code class ="name flex ">
285- < span > def < span class ="ident "> login</ span > </ span > (< span > self)</ span >
288+ < span > def < span class ="ident "> login</ span > </ span > (< span > self) ‑ > str </ span >
286289</ code > </ dt >
287290< dd >
288291< div class ="desc "> < p > This function is used to login to an OpenShift cluster using the user's < code > username</ code > and < code > password</ code > .</ p > </ div >
289292< details class ="source ">
290293< summary >
291294< span > Expand source code</ span >
292295</ summary >
293- < pre > < code class ="python "> def login(self):
296+ < pre > < code class ="python "> def login(self) -> str :
294297 """
295298 This function is used to login to an OpenShift cluster using the user's `username` and `password`.
296299 """
@@ -299,15 +302,15 @@ <h3>Methods</h3>
299302</ details >
300303</ dd >
301304< dt id ="codeflare_sdk.cluster.auth.PasswordUserAuthentication.logout "> < code class ="name flex ">
302- < span > def < span class ="ident "> logout</ span > </ span > (< span > self)</ span >
305+ < span > def < span class ="ident "> logout</ span > </ span > (< span > self) ‑ > str </ span >
303306</ code > </ dt >
304307< dd >
305308< div class ="desc "> < p > This function is used to logout of an OpenShift cluster.</ p > </ div >
306309< details class ="source ">
307310< summary >
308311< span > Expand source code</ span >
309312</ summary >
310- < pre > < code class ="python "> def logout(self):
313+ < pre > < code class ="python "> def logout(self) -> str :
311314 """
312315 This function is used to logout of an OpenShift cluster.
313316 """
@@ -346,7 +349,7 @@ <h3>Methods</h3>
346349 self.server = server
347350 self.skip_tls = skip_tls
348351
349- def login(self):
352+ def login(self) -> str :
350353 """
351354 This function is used to login to an OpenShift cluster using the user's API token and API server address.
352355 Depending on the cluster, a user can choose to login in with "--insecure-skip-tls-verify` by setting `skip_tls`
@@ -361,15 +364,18 @@ <h3>Methods</h3>
361364 error_msg = osp.result.err()
362365 if "The server uses a certificate signed by unknown authority" in error_msg:
363366 return "Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication"
367+ elif "invalid" in error_msg:
368+ raise PermissionError(error_msg)
364369 else:
365370 return error_msg
366371 return response.out()
367372
368- def logout(self):
373+ def logout(self) -> str :
369374 """
370375 This function is used to logout of an OpenShift cluster.
371376 """
372- response = oc.invoke("logout")
377+ args = [f"--token={self.token}", f"--server={self.server}:6443"]
378+ response = oc.invoke("logout", args)
373379 return response.out()</ code > </ pre >
374380</ details >
375381< h3 > Ancestors</ h3 >
@@ -379,7 +385,7 @@ <h3>Ancestors</h3>
379385< h3 > Methods</ h3 >
380386< dl >
381387< dt id ="codeflare_sdk.cluster.auth.TokenAuthentication.login "> < code class ="name flex ">
382- < span > def < span class ="ident "> login</ span > </ span > (< span > self)</ span >
388+ < span > def < span class ="ident "> login</ span > </ span > (< span > self) ‑ > str </ span >
383389</ code > </ dt >
384390< dd >
385391< div class ="desc "> < p > This function is used to login to an OpenShift cluster using the user's API token and API server address.
@@ -389,7 +395,7 @@ <h3>Methods</h3>
389395< summary >
390396< span > Expand source code</ span >
391397</ summary >
392- < pre > < code class ="python "> def login(self):
398+ < pre > < code class ="python "> def login(self) -> str :
393399 """
394400 This function is used to login to an OpenShift cluster using the user's API token and API server address.
395401 Depending on the cluster, a user can choose to login in with "--insecure-skip-tls-verify` by setting `skip_tls`
@@ -404,25 +410,28 @@ <h3>Methods</h3>
404410 error_msg = osp.result.err()
405411 if "The server uses a certificate signed by unknown authority" in error_msg:
406412 return "Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication"
413+ elif "invalid" in error_msg:
414+ raise PermissionError(error_msg)
407415 else:
408416 return error_msg
409417 return response.out()</ code > </ pre >
410418</ details >
411419</ dd >
412420< dt id ="codeflare_sdk.cluster.auth.TokenAuthentication.logout "> < code class ="name flex ">
413- < span > def < span class ="ident "> logout</ span > </ span > (< span > self)</ span >
421+ < span > def < span class ="ident "> logout</ span > </ span > (< span > self) ‑ > str </ span >
414422</ code > </ dt >
415423< dd >
416424< div class ="desc "> < p > This function is used to logout of an OpenShift cluster.</ p > </ div >
417425< details class ="source ">
418426< summary >
419427< span > Expand source code</ span >
420428</ summary >
421- < pre > < code class ="python "> def logout(self):
429+ < pre > < code class ="python "> def logout(self) -> str :
422430 """
423431 This function is used to logout of an OpenShift cluster.
424432 """
425- response = oc.invoke("logout")
433+ args = [f"--token={self.token}", f"--server={self.server}:6443"]
434+ response = oc.invoke("logout", args)
426435 return response.out()</ code > </ pre >
427436</ details >
428437</ dd >
0 commit comments