Skip to content

Commit 449e16e

Browse files
committed
refactor: migrate to rapyuta_io_sdk_v2 and update static route methods
1 parent 7e4e0b8 commit 449e16e

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

riocli/static_route/create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def create_static_route(name: str, spinner=None) -> None:
3838
try:
3939
client = new_v2_client(with_project=True)
4040
payload = {"metadata": {"name": name}}
41-
route = client.create_static_route(payload)
41+
route = client.create_staticroute(payload)
4242
spinner.text = click.style(
4343
f"Static Route created successfully for URL {route.spec.url}",
4444
fg=Colors.GREEN,

riocli/static_route/delete.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from riocli.utils import tabulate_data
2525
from riocli.utils.execute import apply_func_with_result
2626
from riocli.utils.spinner import with_spinner
27-
from riocli.v2client.client import Client
27+
from rapyuta_io_sdk_v2 import Client
2828

2929

3030
@click.command(
@@ -156,7 +156,7 @@ def delete_static_route(
156156

157157
def _apply_delete(client: Client, result: Queue, route: typing.Any) -> None:
158158
try:
159-
client.delete_static_route(name=route.metadata.name)
159+
client.delete_staticroute(name=route.metadata.name)
160160
result.put((route.metadata.name, True, "Static route deleted successfully"))
161161
except Exception as e:
162162
result.put((route.metadata.name, False, str(e)))

riocli/static_route/inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def inspect_static_route(
4545
"""
4646
try:
4747
client = new_v2_client()
48-
route = client.get_static_route(static_route)
48+
route = client.get_staticroute(static_route)
4949
inspect_with_format(unmunchify(route), format_type)
5050
except Exception as e:
5151
click.secho(str(e), fg=Colors.RED)

riocli/static_route/list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def list_static_routes(labels: list[str]) -> None:
5050
"""
5151
try:
5252
client = new_v2_client(with_project=True)
53-
routes = client.list_static_routes(query={"labelSelector": labels})
54-
_display_routes_list(routes)
53+
routes = client.list_staticroutes(label_selector=labels)
54+
_display_routes_list(routes.items)
5555
except Exception as e:
5656
click.secho(str(e), fg=Colors.RED)
5757
raise SystemExit(1) from e

riocli/static_route/model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from riocli.constants import ApplyResult
1818
from riocli.exceptions import ResourceNotFound
1919
from riocli.model import Model
20-
from riocli.v2client.error import HttpAlreadyExistsError, HttpNotFoundError
20+
from rapyuta_io_sdk_v2.exceptions import HttpAlreadyExistsError, HttpNotFoundError
2121

2222

2323
class StaticRoute(Model):
@@ -31,10 +31,10 @@ def apply(self, *args, **kwargs) -> ApplyResult:
3131
static_route = unmunchify(self)
3232

3333
try:
34-
client.create_static_route(static_route)
34+
client.create_staticroute(static_route)
3535
return ApplyResult.CREATED
3636
except HttpAlreadyExistsError:
37-
client.update_static_route(self.metadata.name, static_route)
37+
client.update_staticroute(self.metadata.name, static_route)
3838
return ApplyResult.UPDATED
3939

4040
def delete(self, *args, **kwargs) -> None:
@@ -43,6 +43,6 @@ def delete(self, *args, **kwargs) -> None:
4343
short_id = Configuration().organization_short_id
4444

4545
try:
46-
client.delete_static_route(f"{self.metadata.name}-{short_id}")
46+
client.delete_staticroute(f"{self.metadata.name}-{short_id}")
4747
except HttpNotFoundError:
4848
raise ResourceNotFound

riocli/static_route/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from riocli.config import new_v2_client
2020
from riocli.utils import tabulate_data
21-
from riocli.v2client.client import Client
21+
from rapyuta_io_sdk_v2 import Client
2222

2323

2424
class StaticRouteNotFound(Exception):

0 commit comments

Comments
 (0)