This repository was archived by the owner on Jan 23, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
jumpstarter-cli-admin/jumpstarter_cli_admin
jumpstarter-kubernetes/jumpstarter_kubernetes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import asyncclick as click
55from jumpstarter_cli_common import (
66 AliasedGroup ,
7- OutputMode ,
87 OutputType ,
98 opt_context ,
109 opt_kubeconfig ,
@@ -38,11 +37,8 @@ def create(log_level: Optional[str]):
3837
3938
4039def print_created_client (client : V1Alpha1Client , output : OutputType ):
41- match output :
42- case OutputMode .JSON | OutputMode .YAML :
43- click .echo (client .dump (output ))
44- case OutputMode .NAME :
45- click .echo (f"client.jumpstarter.dev/{ client .metadata .name } " )
40+ if output is not None :
41+ click .echo (client .dump (output ))
4642
4743
4844@create .command ("client" )
@@ -126,11 +122,8 @@ async def create_client(
126122
127123
128124def print_created_exporter (exporter : V1Alpha1Exporter , output : OutputType ):
129- match output :
130- case OutputMode .JSON | OutputMode .YAML :
131- click .echo (exporter .dump (output ))
132- case OutputMode .NAME :
133- click .echo (f"exporter.jumpstarter.dev/{ exporter .metadata .name } " )
125+ if output is not None :
126+ click .echo (exporter .dump (output ))
134127
135128
136129@create .command ("exporter" )
Original file line number Diff line number Diff line change @@ -25,10 +25,8 @@ def make_client_row(client: V1Alpha1Client):
2525
2626def print_client (client : V1Alpha1Client , output : OutputType ):
2727 match output :
28- case OutputMode .JSON | OutputMode .YAML :
28+ case OutputMode .JSON | OutputMode .YAML | OutputMode . NAME :
2929 click .echo (client .dump (output ))
30- case OutputMode .NAME :
31- click .echo (f"client.jumpstarter.dev/{ client .metadata .name } " )
3230 case _:
3331 click .echo (make_table (CLIENT_COLUMNS , [make_client_row (client )]))
3432
@@ -84,10 +82,8 @@ def get_device_rows(exporters: list[V1Alpha1Exporter]):
8482
8583def print_exporter (exporter : V1Alpha1Exporter , devices : bool , output : OutputType ):
8684 match output :
87- case OutputMode .JSON | OutputMode .YAML :
85+ case OutputMode .JSON | OutputMode .YAML | OutputMode . NAME :
8886 click .echo (exporter .dump (output ))
89- case OutputMode .NAME :
90- click .echo (f"exporter.jumpstarter.dev/{ exporter .metadata .name } " )
9187 case _:
9288 if devices :
9389 # Print the devices for the exporter
Original file line number Diff line number Diff line change 11from pydantic import ConfigDict
22
3- from jumpstarter .common .pydantic import SerializableBaseModel
3+ from jumpstarter .common .pydantic import OutputMode , OutputType , SerializableBaseModel
44
55
66class JsonBaseModel (SerializableBaseModel ):
77 """A Pydantic BaseModel with additional Jumpstarter JSON options applied."""
88
9+ def dump (self , mode : OutputType = None ):
10+ match mode :
11+ case OutputMode .NAME :
12+ return self .dump_name ()
13+ case _:
14+ return super ().dump (mode )
15+
16+ def dump_name (self ):
17+ return "{}.jumpstarter.dev/{}" .format (self .kind .lower (), self .metadata .name )
18+
919 model_config = ConfigDict (arbitrary_types_allowed = True , populate_by_name = True )
You can’t perform that action at this time.
0 commit comments