This repository was archived by the owner on Jan 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathget.py
More file actions
62 lines (51 loc) · 1.7 KB
/
get.py
File metadata and controls
62 lines (51 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import click
from jumpstarter_cli_common.config import opt_config
from jumpstarter_cli_common.exceptions import handle_exceptions_with_reauthentication
from jumpstarter_cli_common.opt import OutputType, opt_comma_separated, opt_output_all
from jumpstarter_cli_common.print import model_print
from .common import opt_selector
from .login import relogin_client
@click.group()
def get():
"""
Display one or many resources
"""
@get.command(name="exporters")
@opt_config(exporter=False)
@opt_selector
@opt_output_all
@opt_comma_separated(
"with",
{"leases", "online", "status"},
help_text="Include fields: leases, online, status (comma-separated or repeated)",
)
@handle_exceptions_with_reauthentication(relogin_client)
def get_exporters(config, selector: str | None, output: OutputType, with_options: list[str]):
"""
Display one or many exporters
"""
include_leases = "leases" in with_options
include_online = "online" in with_options
include_status = "status" in with_options
exporters = config.list_exporters(
filter=selector, include_leases=include_leases, include_online=include_online, include_status=include_status
)
model_print(exporters, output)
@get.command(name="leases")
@opt_config(exporter=False)
@opt_selector
@opt_output_all
@click.option(
"--all",
"show_all",
is_flag=True,
default=False,
help="Show all leases including expired ones"
)
@handle_exceptions_with_reauthentication(relogin_client)
def get_leases(config, selector: str | None, output: OutputType, show_all: bool):
"""
Display one or many leases
"""
leases = config.list_leases(filter=selector, only_active=not show_all)
model_print(leases, output)