-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathretrieve.py
More file actions
36 lines (29 loc) · 880 Bytes
/
retrieve.py
File metadata and controls
36 lines (29 loc) · 880 Bytes
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
import json as json_lib
import click
from rich import print
from together import Together
from together.lib.cli._track_cli import auto_track_command
from together.lib.cli.api._utils import handle_api_errors
@click.command()
@click.argument(
"volume-id",
required=True,
)
@click.option(
"--json",
is_flag=True,
help="Output in JSON format",
)
@click.pass_context
@handle_api_errors("Clusters Storage")
@auto_track_command("clusters storage retrieve")
def retrieve(ctx: click.Context, volume_id: str, json: bool) -> None:
"""Retrieve a storage volume"""
client: Together = ctx.obj
if not json:
click.echo(f"Clusters Storage: Retrieving storage volume...")
response = client.beta.clusters.storage.retrieve(volume_id)
if json:
click.echo(json_lib.dumps(response.model_dump(), indent=2))
else:
print(response)