pltr-cli 0.12.0__py3-none-any.whl → 0.13.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pltr/__init__.py +1 -1
- pltr/cli.py +24 -0
- pltr/commands/admin.py +12 -2
- pltr/commands/functions.py +503 -0
- pltr/commands/language_models.py +515 -0
- pltr/commands/models.py +362 -0
- pltr/commands/project.py +21 -61
- pltr/commands/resource.py +0 -53
- pltr/commands/space.py +25 -303
- pltr/commands/streams.py +616 -0
- pltr/services/admin.py +15 -4
- pltr/services/dataset.py +2 -3
- pltr/services/folder.py +6 -1
- pltr/services/functions.py +223 -0
- pltr/services/language_models.py +281 -0
- pltr/services/models.py +179 -0
- pltr/services/project.py +87 -49
- pltr/services/resource.py +14 -72
- pltr/services/space.py +24 -175
- pltr/services/streams.py +290 -0
- {pltr_cli-0.12.0.dist-info → pltr_cli-0.13.0.dist-info}/METADATA +51 -2
- {pltr_cli-0.12.0.dist-info → pltr_cli-0.13.0.dist-info}/RECORD +25 -17
- {pltr_cli-0.12.0.dist-info → pltr_cli-0.13.0.dist-info}/WHEEL +0 -0
- {pltr_cli-0.12.0.dist-info → pltr_cli-0.13.0.dist-info}/entry_points.txt +0 -0
- {pltr_cli-0.12.0.dist-info → pltr_cli-0.13.0.dist-info}/licenses/LICENSE +0 -0
pltr/commands/models.py
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Models management commands for Foundry.
|
|
3
|
+
Provides commands for managing ML models and model versions in the registry.
|
|
4
|
+
|
|
5
|
+
Note: This is distinct from LanguageModels, which handles LLM chat/embeddings operations.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import typer
|
|
9
|
+
from typing import Optional
|
|
10
|
+
from rich.console import Console
|
|
11
|
+
|
|
12
|
+
from ..services.models import ModelsService
|
|
13
|
+
from ..utils.formatting import OutputFormatter
|
|
14
|
+
from ..utils.progress import SpinnerProgressTracker
|
|
15
|
+
from ..auth.base import ProfileNotFoundError, MissingCredentialsError
|
|
16
|
+
from ..utils.completion import (
|
|
17
|
+
complete_rid,
|
|
18
|
+
complete_profile,
|
|
19
|
+
complete_output_format,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
# Create main app and sub-apps
|
|
23
|
+
app = typer.Typer(help="Manage ML models and versions")
|
|
24
|
+
model_app = typer.Typer(help="Manage models")
|
|
25
|
+
version_app = typer.Typer(help="Manage model versions")
|
|
26
|
+
|
|
27
|
+
# Add sub-apps
|
|
28
|
+
app.add_typer(model_app, name="model")
|
|
29
|
+
app.add_typer(version_app, name="version")
|
|
30
|
+
|
|
31
|
+
console = Console()
|
|
32
|
+
formatter = OutputFormatter(console)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@model_app.command("create")
|
|
36
|
+
def create_model(
|
|
37
|
+
name: str = typer.Argument(
|
|
38
|
+
...,
|
|
39
|
+
help="Model name",
|
|
40
|
+
),
|
|
41
|
+
folder: str = typer.Option(
|
|
42
|
+
...,
|
|
43
|
+
"--folder",
|
|
44
|
+
"-f",
|
|
45
|
+
help="Parent folder RID (e.g., ri.compass.main.folder.xxx)",
|
|
46
|
+
autocompletion=complete_rid,
|
|
47
|
+
),
|
|
48
|
+
profile: Optional[str] = typer.Option(
|
|
49
|
+
None,
|
|
50
|
+
"--profile",
|
|
51
|
+
"-p",
|
|
52
|
+
help="Profile name",
|
|
53
|
+
autocompletion=complete_profile,
|
|
54
|
+
),
|
|
55
|
+
format: str = typer.Option(
|
|
56
|
+
"table",
|
|
57
|
+
"--format",
|
|
58
|
+
help="Output format (table, json, csv)",
|
|
59
|
+
autocompletion=complete_output_format,
|
|
60
|
+
),
|
|
61
|
+
output: Optional[str] = typer.Option(
|
|
62
|
+
None,
|
|
63
|
+
"--output",
|
|
64
|
+
"-o",
|
|
65
|
+
help="Output file path (writes to file instead of stdout)",
|
|
66
|
+
),
|
|
67
|
+
preview: bool = typer.Option(
|
|
68
|
+
False,
|
|
69
|
+
"--preview",
|
|
70
|
+
help="Enable preview mode",
|
|
71
|
+
),
|
|
72
|
+
):
|
|
73
|
+
"""
|
|
74
|
+
Create a new ML model in the registry.
|
|
75
|
+
|
|
76
|
+
Creates a model container that can hold multiple versions.
|
|
77
|
+
|
|
78
|
+
Note: SDK does not support listing all models. Use the Foundry web UI
|
|
79
|
+
or Ontology API to discover existing models.
|
|
80
|
+
|
|
81
|
+
Examples:
|
|
82
|
+
|
|
83
|
+
# Create a new model
|
|
84
|
+
pltr models model create "fraud-detector" \\
|
|
85
|
+
--folder ri.compass.main.folder.xxx
|
|
86
|
+
|
|
87
|
+
# Create with JSON output
|
|
88
|
+
pltr models model create "recommendation-engine" \\
|
|
89
|
+
--folder ri.compass.main.folder.xxx \\
|
|
90
|
+
--format json
|
|
91
|
+
|
|
92
|
+
# Save to file
|
|
93
|
+
pltr models model create "anomaly-detector" \\
|
|
94
|
+
--folder ri.compass.main.folder.xxx \\
|
|
95
|
+
--output model-info.json
|
|
96
|
+
"""
|
|
97
|
+
try:
|
|
98
|
+
with SpinnerProgressTracker().track_spinner("Creating model"):
|
|
99
|
+
service = ModelsService(profile=profile)
|
|
100
|
+
result = service.create_model(
|
|
101
|
+
name=name,
|
|
102
|
+
parent_folder_rid=folder,
|
|
103
|
+
preview=preview,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
console.print(f"[green]✓[/green] Created model: {result.get('name')}")
|
|
107
|
+
console.print(f" Model RID: {result.get('rid')}")
|
|
108
|
+
|
|
109
|
+
formatter.format_output(result, format, output)
|
|
110
|
+
|
|
111
|
+
if output:
|
|
112
|
+
console.print(f"[green]✓[/green] Model information saved to {output}")
|
|
113
|
+
|
|
114
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
115
|
+
console.print(f"[red]Authentication Error: {e}[/red]")
|
|
116
|
+
raise typer.Exit(1)
|
|
117
|
+
except Exception as e:
|
|
118
|
+
console.print(f"[red]Error: {e}[/red]")
|
|
119
|
+
raise typer.Exit(1)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@model_app.command("get")
|
|
123
|
+
def get_model(
|
|
124
|
+
model_rid: str = typer.Argument(
|
|
125
|
+
...,
|
|
126
|
+
help="Model RID (e.g., ri.foundry.main.model.xxx)",
|
|
127
|
+
autocompletion=complete_rid,
|
|
128
|
+
),
|
|
129
|
+
profile: Optional[str] = typer.Option(
|
|
130
|
+
None,
|
|
131
|
+
"--profile",
|
|
132
|
+
"-p",
|
|
133
|
+
help="Profile name",
|
|
134
|
+
autocompletion=complete_profile,
|
|
135
|
+
),
|
|
136
|
+
format: str = typer.Option(
|
|
137
|
+
"table",
|
|
138
|
+
"--format",
|
|
139
|
+
help="Output format (table, json, csv)",
|
|
140
|
+
autocompletion=complete_output_format,
|
|
141
|
+
),
|
|
142
|
+
output: Optional[str] = typer.Option(
|
|
143
|
+
None,
|
|
144
|
+
"--output",
|
|
145
|
+
"-o",
|
|
146
|
+
help="Output file path (writes to file instead of stdout)",
|
|
147
|
+
),
|
|
148
|
+
preview: bool = typer.Option(
|
|
149
|
+
False,
|
|
150
|
+
"--preview",
|
|
151
|
+
help="Enable preview mode",
|
|
152
|
+
),
|
|
153
|
+
):
|
|
154
|
+
"""
|
|
155
|
+
Get information about a model.
|
|
156
|
+
|
|
157
|
+
Retrieves model metadata including name, folder location, and other properties.
|
|
158
|
+
|
|
159
|
+
Examples:
|
|
160
|
+
|
|
161
|
+
# Get model details
|
|
162
|
+
pltr models model get ri.foundry.main.model.abc123
|
|
163
|
+
|
|
164
|
+
# Get as JSON
|
|
165
|
+
pltr models model get ri.foundry.main.model.abc123 --format json
|
|
166
|
+
|
|
167
|
+
# Save to file
|
|
168
|
+
pltr models model get ri.foundry.main.model.abc123 \\
|
|
169
|
+
--format json \\
|
|
170
|
+
--output model-details.json
|
|
171
|
+
"""
|
|
172
|
+
try:
|
|
173
|
+
with SpinnerProgressTracker().track_spinner("Fetching model information"):
|
|
174
|
+
service = ModelsService(profile=profile)
|
|
175
|
+
result = service.get_model(
|
|
176
|
+
model_rid=model_rid,
|
|
177
|
+
preview=preview,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
formatter.format_output(result, format, output)
|
|
181
|
+
|
|
182
|
+
if output:
|
|
183
|
+
console.print(f"[green]✓[/green] Model information saved to {output}")
|
|
184
|
+
|
|
185
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
186
|
+
console.print(f"[red]Authentication Error: {e}[/red]")
|
|
187
|
+
raise typer.Exit(1)
|
|
188
|
+
except Exception as e:
|
|
189
|
+
console.print(f"[red]Error: {e}[/red]")
|
|
190
|
+
raise typer.Exit(1)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
@version_app.command("get")
|
|
194
|
+
def get_version(
|
|
195
|
+
model_rid: str = typer.Argument(
|
|
196
|
+
...,
|
|
197
|
+
help="Model RID (e.g., ri.foundry.main.model.xxx)",
|
|
198
|
+
autocompletion=complete_rid,
|
|
199
|
+
),
|
|
200
|
+
version_rid: str = typer.Argument(
|
|
201
|
+
...,
|
|
202
|
+
help="Version identifier (e.g., v1.0.0 or version RID)",
|
|
203
|
+
),
|
|
204
|
+
profile: Optional[str] = typer.Option(
|
|
205
|
+
None,
|
|
206
|
+
"--profile",
|
|
207
|
+
"-p",
|
|
208
|
+
help="Profile name",
|
|
209
|
+
autocompletion=complete_profile,
|
|
210
|
+
),
|
|
211
|
+
format: str = typer.Option(
|
|
212
|
+
"table",
|
|
213
|
+
"--format",
|
|
214
|
+
help="Output format (table, json, csv)",
|
|
215
|
+
autocompletion=complete_output_format,
|
|
216
|
+
),
|
|
217
|
+
output: Optional[str] = typer.Option(
|
|
218
|
+
None,
|
|
219
|
+
"--output",
|
|
220
|
+
"-o",
|
|
221
|
+
help="Output file path (writes to file instead of stdout)",
|
|
222
|
+
),
|
|
223
|
+
preview: bool = typer.Option(
|
|
224
|
+
False,
|
|
225
|
+
"--preview",
|
|
226
|
+
help="Enable preview mode",
|
|
227
|
+
),
|
|
228
|
+
):
|
|
229
|
+
"""
|
|
230
|
+
Get information about a specific model version.
|
|
231
|
+
|
|
232
|
+
Retrieves version metadata including creation time, schema, and other properties.
|
|
233
|
+
|
|
234
|
+
Examples:
|
|
235
|
+
|
|
236
|
+
# Get specific version
|
|
237
|
+
pltr models version get ri.foundry.main.model.abc123 v1.0.0
|
|
238
|
+
|
|
239
|
+
# Get as JSON
|
|
240
|
+
pltr models version get ri.foundry.main.model.abc123 v1.0.0 \\
|
|
241
|
+
--format json
|
|
242
|
+
|
|
243
|
+
# Save to file
|
|
244
|
+
pltr models version get ri.foundry.main.model.abc123 v1.0.0 \\
|
|
245
|
+
--format json \\
|
|
246
|
+
--output version-details.json
|
|
247
|
+
"""
|
|
248
|
+
try:
|
|
249
|
+
with SpinnerProgressTracker().track_spinner("Fetching version information"):
|
|
250
|
+
service = ModelsService(profile=profile)
|
|
251
|
+
result = service.get_model_version(
|
|
252
|
+
model_rid=model_rid,
|
|
253
|
+
model_version_rid=version_rid,
|
|
254
|
+
preview=preview,
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
formatter.format_output(result, format, output)
|
|
258
|
+
|
|
259
|
+
if output:
|
|
260
|
+
console.print(f"[green]✓[/green] Version information saved to {output}")
|
|
261
|
+
|
|
262
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
263
|
+
console.print(f"[red]Authentication Error: {e}[/red]")
|
|
264
|
+
raise typer.Exit(1)
|
|
265
|
+
except Exception as e:
|
|
266
|
+
console.print(f"[red]Error: {e}[/red]")
|
|
267
|
+
raise typer.Exit(1)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
@version_app.command("list")
|
|
271
|
+
def list_versions(
|
|
272
|
+
model_rid: str = typer.Argument(
|
|
273
|
+
...,
|
|
274
|
+
help="Model RID (e.g., ri.foundry.main.model.xxx)",
|
|
275
|
+
autocompletion=complete_rid,
|
|
276
|
+
),
|
|
277
|
+
page_size: Optional[int] = typer.Option(
|
|
278
|
+
None,
|
|
279
|
+
"--page-size",
|
|
280
|
+
help="Maximum number of versions to return per page",
|
|
281
|
+
),
|
|
282
|
+
page_token: Optional[str] = typer.Option(
|
|
283
|
+
None,
|
|
284
|
+
"--page-token",
|
|
285
|
+
help="Token for fetching next page of results",
|
|
286
|
+
),
|
|
287
|
+
profile: Optional[str] = typer.Option(
|
|
288
|
+
None,
|
|
289
|
+
"--profile",
|
|
290
|
+
"-p",
|
|
291
|
+
help="Profile name",
|
|
292
|
+
autocompletion=complete_profile,
|
|
293
|
+
),
|
|
294
|
+
format: str = typer.Option(
|
|
295
|
+
"table",
|
|
296
|
+
"--format",
|
|
297
|
+
help="Output format (table, json, csv)",
|
|
298
|
+
autocompletion=complete_output_format,
|
|
299
|
+
),
|
|
300
|
+
output: Optional[str] = typer.Option(
|
|
301
|
+
None,
|
|
302
|
+
"--output",
|
|
303
|
+
"-o",
|
|
304
|
+
help="Output file path (writes to file instead of stdout)",
|
|
305
|
+
),
|
|
306
|
+
preview: bool = typer.Option(
|
|
307
|
+
False,
|
|
308
|
+
"--preview",
|
|
309
|
+
help="Enable preview mode",
|
|
310
|
+
),
|
|
311
|
+
):
|
|
312
|
+
"""
|
|
313
|
+
List all versions of a model with pagination support.
|
|
314
|
+
|
|
315
|
+
Returns a list of model versions with their metadata.
|
|
316
|
+
|
|
317
|
+
Examples:
|
|
318
|
+
|
|
319
|
+
# List all versions
|
|
320
|
+
pltr models version list ri.foundry.main.model.abc123
|
|
321
|
+
|
|
322
|
+
# List with pagination
|
|
323
|
+
pltr models version list ri.foundry.main.model.abc123 \\
|
|
324
|
+
--page-size 50
|
|
325
|
+
|
|
326
|
+
# Get next page
|
|
327
|
+
pltr models version list ri.foundry.main.model.abc123 \\
|
|
328
|
+
--page-size 50 \\
|
|
329
|
+
--page-token <token-from-previous-response>
|
|
330
|
+
|
|
331
|
+
# Save to file
|
|
332
|
+
pltr models version list ri.foundry.main.model.abc123 \\
|
|
333
|
+
--format json \\
|
|
334
|
+
--output versions.json
|
|
335
|
+
"""
|
|
336
|
+
try:
|
|
337
|
+
with SpinnerProgressTracker().track_spinner("Fetching model versions"):
|
|
338
|
+
service = ModelsService(profile=profile)
|
|
339
|
+
result = service.list_model_versions(
|
|
340
|
+
model_rid=model_rid,
|
|
341
|
+
page_size=page_size,
|
|
342
|
+
page_token=page_token,
|
|
343
|
+
preview=preview,
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
formatter.format_output(result, format, output)
|
|
347
|
+
|
|
348
|
+
# Show pagination info if available (only when outputting to console, not file)
|
|
349
|
+
if not output and result.get("nextPageToken"):
|
|
350
|
+
console.print(
|
|
351
|
+
f"[dim]Next page available. Use --page-token {result['nextPageToken']}[/dim]"
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
if output:
|
|
355
|
+
console.print(f"[green]✓[/green] Version list saved to {output}")
|
|
356
|
+
|
|
357
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
358
|
+
console.print(f"[red]Authentication Error: {e}[/red]")
|
|
359
|
+
raise typer.Exit(1)
|
|
360
|
+
except Exception as e:
|
|
361
|
+
console.print(f"[red]Error: {e}[/red]")
|
|
362
|
+
raise typer.Exit(1)
|
pltr/commands/project.py
CHANGED
|
@@ -42,6 +42,16 @@ def create_project(
|
|
|
42
42
|
"-org",
|
|
43
43
|
help="Organization RIDs (can be specified multiple times)",
|
|
44
44
|
),
|
|
45
|
+
owner_id: Optional[str] = typer.Option(
|
|
46
|
+
None,
|
|
47
|
+
"--owner-id",
|
|
48
|
+
help="Owner principal id (user or group) for compass:manage",
|
|
49
|
+
),
|
|
50
|
+
owner_type: str = typer.Option(
|
|
51
|
+
"USER",
|
|
52
|
+
"--owner-type",
|
|
53
|
+
help="Owner principal type (USER or GROUP)",
|
|
54
|
+
),
|
|
45
55
|
profile: Optional[str] = typer.Option(
|
|
46
56
|
None, "--profile", help="Profile name", autocompletion=complete_profile
|
|
47
57
|
),
|
|
@@ -57,12 +67,23 @@ def create_project(
|
|
|
57
67
|
try:
|
|
58
68
|
service = ProjectService(profile=profile)
|
|
59
69
|
|
|
70
|
+
role_grants = None
|
|
71
|
+
if owner_id:
|
|
72
|
+
role_grants = [
|
|
73
|
+
{
|
|
74
|
+
"principal_id": owner_id,
|
|
75
|
+
"principal_type": owner_type,
|
|
76
|
+
"role_name": "compass:manage",
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
|
|
60
80
|
with SpinnerProgressTracker().track_spinner(f"Creating project '{name}'..."):
|
|
61
81
|
project = service.create_project(
|
|
62
82
|
display_name=name,
|
|
63
83
|
space_rid=space_rid,
|
|
64
84
|
description=description,
|
|
65
85
|
organization_rids=organization_rids,
|
|
86
|
+
role_grants=role_grants,
|
|
66
87
|
)
|
|
67
88
|
|
|
68
89
|
# Cache the RID for future completions
|
|
@@ -305,67 +326,6 @@ def delete_project(
|
|
|
305
326
|
raise typer.Exit(1)
|
|
306
327
|
|
|
307
328
|
|
|
308
|
-
@app.command("batch-get")
|
|
309
|
-
def get_projects_batch(
|
|
310
|
-
project_rids: List[str] = typer.Argument(
|
|
311
|
-
..., help="Project Resource Identifiers (space-separated)"
|
|
312
|
-
),
|
|
313
|
-
profile: Optional[str] = typer.Option(
|
|
314
|
-
None, "--profile", help="Profile name", autocompletion=complete_profile
|
|
315
|
-
),
|
|
316
|
-
format: str = typer.Option(
|
|
317
|
-
"table",
|
|
318
|
-
"--format",
|
|
319
|
-
"-f",
|
|
320
|
-
help="Output format (table, json, csv)",
|
|
321
|
-
autocompletion=complete_output_format,
|
|
322
|
-
),
|
|
323
|
-
output: Optional[str] = typer.Option(
|
|
324
|
-
None, "--output", "-o", help="Output file path"
|
|
325
|
-
),
|
|
326
|
-
):
|
|
327
|
-
"""Get multiple projects in a single request (max 1000)."""
|
|
328
|
-
try:
|
|
329
|
-
service = ProjectService(profile=profile)
|
|
330
|
-
|
|
331
|
-
with SpinnerProgressTracker().track_spinner(
|
|
332
|
-
f"Fetching {len(project_rids)} projects..."
|
|
333
|
-
):
|
|
334
|
-
projects = service.get_projects_batch(project_rids)
|
|
335
|
-
|
|
336
|
-
# Cache RIDs for future completions
|
|
337
|
-
for project in projects:
|
|
338
|
-
if project.get("rid"):
|
|
339
|
-
cache_rid(project["rid"])
|
|
340
|
-
|
|
341
|
-
# Format output
|
|
342
|
-
if format == "json":
|
|
343
|
-
if output:
|
|
344
|
-
formatter.save_to_file(projects, output, "json")
|
|
345
|
-
else:
|
|
346
|
-
formatter.format_list(projects)
|
|
347
|
-
elif format == "csv":
|
|
348
|
-
if output:
|
|
349
|
-
formatter.save_to_file(projects, output, "csv")
|
|
350
|
-
else:
|
|
351
|
-
formatter.format_list(projects)
|
|
352
|
-
else:
|
|
353
|
-
_format_projects_table(projects)
|
|
354
|
-
|
|
355
|
-
if output:
|
|
356
|
-
formatter.print_success(f"Projects information saved to {output}")
|
|
357
|
-
|
|
358
|
-
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
359
|
-
formatter.print_error(f"Authentication error: {e}")
|
|
360
|
-
raise typer.Exit(1)
|
|
361
|
-
except ValueError as e:
|
|
362
|
-
formatter.print_error(f"Invalid request: {e}")
|
|
363
|
-
raise typer.Exit(1)
|
|
364
|
-
except Exception as e:
|
|
365
|
-
formatter.print_error(f"Failed to get projects batch: {e}")
|
|
366
|
-
raise typer.Exit(1)
|
|
367
|
-
|
|
368
|
-
|
|
369
329
|
# ==================== Organization Operations ====================
|
|
370
330
|
|
|
371
331
|
|
pltr/commands/resource.py
CHANGED
|
@@ -409,56 +409,6 @@ def get_resource_metadata(
|
|
|
409
409
|
raise typer.Exit(1)
|
|
410
410
|
|
|
411
411
|
|
|
412
|
-
@app.command("move")
|
|
413
|
-
def move_resource(
|
|
414
|
-
resource_rid: str = typer.Argument(
|
|
415
|
-
..., help="Resource Identifier", autocompletion=complete_rid
|
|
416
|
-
),
|
|
417
|
-
target_folder_rid: str = typer.Option(
|
|
418
|
-
...,
|
|
419
|
-
"--target-folder",
|
|
420
|
-
"-t",
|
|
421
|
-
help="Target folder Resource Identifier",
|
|
422
|
-
autocompletion=complete_rid,
|
|
423
|
-
),
|
|
424
|
-
profile: Optional[str] = typer.Option(
|
|
425
|
-
None, "--profile", help="Profile name", autocompletion=complete_profile
|
|
426
|
-
),
|
|
427
|
-
format: str = typer.Option(
|
|
428
|
-
"table",
|
|
429
|
-
"--format",
|
|
430
|
-
"-f",
|
|
431
|
-
help="Output format (table, json, csv)",
|
|
432
|
-
autocompletion=complete_output_format,
|
|
433
|
-
),
|
|
434
|
-
):
|
|
435
|
-
"""Move a resource to a different folder."""
|
|
436
|
-
try:
|
|
437
|
-
service = ResourceService(profile=profile)
|
|
438
|
-
|
|
439
|
-
with SpinnerProgressTracker().track_spinner(
|
|
440
|
-
f"Moving resource {resource_rid} to {target_folder_rid}..."
|
|
441
|
-
):
|
|
442
|
-
resource = service.move_resource(resource_rid, target_folder_rid)
|
|
443
|
-
|
|
444
|
-
formatter.print_success(f"Successfully moved resource to {target_folder_rid}")
|
|
445
|
-
|
|
446
|
-
# Format output
|
|
447
|
-
if format == "json":
|
|
448
|
-
formatter.format_dict(resource)
|
|
449
|
-
elif format == "csv":
|
|
450
|
-
formatter.format_list([resource])
|
|
451
|
-
else:
|
|
452
|
-
_format_resource_table(resource)
|
|
453
|
-
|
|
454
|
-
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
455
|
-
formatter.print_error(f"Authentication error: {e}")
|
|
456
|
-
raise typer.Exit(1)
|
|
457
|
-
except Exception as e:
|
|
458
|
-
formatter.print_error(f"Failed to move resource: {e}")
|
|
459
|
-
raise typer.Exit(1)
|
|
460
|
-
|
|
461
|
-
|
|
462
412
|
# ==================== Trash Operations ====================
|
|
463
413
|
|
|
464
414
|
|
|
@@ -990,9 +940,6 @@ def main():
|
|
|
990
940
|
# Get resource metadata
|
|
991
941
|
pltr resource get-metadata ri.compass.main.dataset.xyz123
|
|
992
942
|
|
|
993
|
-
# Move resource to different folder
|
|
994
|
-
pltr resource move ri.compass.main.dataset.xyz123 --target-folder ri.compass.main.folder.new456
|
|
995
|
-
|
|
996
943
|
# Trash operations
|
|
997
944
|
pltr resource delete ri.compass.main.dataset.xyz123
|
|
998
945
|
pltr resource restore ri.compass.main.dataset.xyz123
|