pltr-cli 0.11.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.
Files changed (46) hide show
  1. pltr/__init__.py +1 -1
  2. pltr/cli.py +40 -0
  3. pltr/commands/admin.py +565 -11
  4. pltr/commands/aip_agents.py +333 -0
  5. pltr/commands/connectivity.py +309 -1
  6. pltr/commands/cp.py +103 -0
  7. pltr/commands/dataset.py +104 -4
  8. pltr/commands/functions.py +503 -0
  9. pltr/commands/language_models.py +515 -0
  10. pltr/commands/mediasets.py +176 -0
  11. pltr/commands/models.py +362 -0
  12. pltr/commands/ontology.py +44 -13
  13. pltr/commands/orchestration.py +167 -11
  14. pltr/commands/project.py +231 -22
  15. pltr/commands/resource.py +416 -17
  16. pltr/commands/space.py +25 -303
  17. pltr/commands/sql.py +54 -7
  18. pltr/commands/streams.py +616 -0
  19. pltr/commands/third_party_applications.py +82 -0
  20. pltr/services/admin.py +331 -3
  21. pltr/services/aip_agents.py +147 -0
  22. pltr/services/base.py +104 -1
  23. pltr/services/connectivity.py +139 -0
  24. pltr/services/copy.py +391 -0
  25. pltr/services/dataset.py +77 -4
  26. pltr/services/folder.py +6 -1
  27. pltr/services/functions.py +223 -0
  28. pltr/services/language_models.py +281 -0
  29. pltr/services/mediasets.py +144 -9
  30. pltr/services/models.py +179 -0
  31. pltr/services/ontology.py +48 -1
  32. pltr/services/orchestration.py +133 -1
  33. pltr/services/project.py +213 -39
  34. pltr/services/resource.py +229 -60
  35. pltr/services/space.py +24 -175
  36. pltr/services/sql.py +44 -20
  37. pltr/services/streams.py +290 -0
  38. pltr/services/third_party_applications.py +53 -0
  39. pltr/utils/formatting.py +195 -1
  40. pltr/utils/pagination.py +325 -0
  41. {pltr_cli-0.11.0.dist-info → pltr_cli-0.13.0.dist-info}/METADATA +55 -4
  42. pltr_cli-0.13.0.dist-info/RECORD +70 -0
  43. {pltr_cli-0.11.0.dist-info → pltr_cli-0.13.0.dist-info}/WHEEL +1 -1
  44. pltr_cli-0.11.0.dist-info/RECORD +0 -55
  45. {pltr_cli-0.11.0.dist-info → pltr_cli-0.13.0.dist-info}/entry_points.txt +0 -0
  46. {pltr_cli-0.11.0.dist-info → pltr_cli-0.13.0.dist-info}/licenses/LICENSE +0 -0
pltr/commands/space.py CHANGED
@@ -26,13 +26,25 @@ formatter = OutputFormatter(console)
26
26
  @app.command("create")
27
27
  def create_space(
28
28
  name: str = typer.Argument(..., help="Space display name"),
29
- organization_rid: str = typer.Option(
29
+ enrollment_rid: str = typer.Option(
30
30
  ...,
31
- "--organization-rid",
32
- "-org",
33
- help="Organization Resource Identifier",
31
+ "--enrollment-rid",
32
+ "-e",
33
+ help="Enrollment Resource Identifier",
34
34
  autocompletion=complete_rid,
35
35
  ),
36
+ organizations: List[str] = typer.Option(
37
+ ...,
38
+ "--organization",
39
+ "-org",
40
+ help="Organization RID(s) (can specify multiple)",
41
+ ),
42
+ deletion_policy_organizations: List[str] = typer.Option(
43
+ ...,
44
+ "--deletion-policy-org",
45
+ "-dpo",
46
+ help="Organization RID(s) for deletion policy (can specify multiple)",
47
+ ),
36
48
  description: Optional[str] = typer.Option(
37
49
  None, "--description", "-d", help="Space description"
38
50
  ),
@@ -54,7 +66,9 @@ def create_space(
54
66
  with SpinnerProgressTracker().track_spinner(f"Creating space '{name}'..."):
55
67
  space = service.create_space(
56
68
  display_name=name,
57
- organization_rid=organization_rid,
69
+ enrollment_rid=enrollment_rid,
70
+ organizations=organizations,
71
+ deletion_policy_organizations=deletion_policy_organizations,
58
72
  description=description,
59
73
  )
60
74
 
@@ -295,250 +309,6 @@ def delete_space(
295
309
  raise typer.Exit(1)
296
310
 
297
311
 
298
- @app.command("batch-get")
299
- def get_spaces_batch(
300
- space_rids: List[str] = typer.Argument(
301
- ..., help="Space Resource Identifiers (space-separated)"
302
- ),
303
- profile: Optional[str] = typer.Option(
304
- None, "--profile", help="Profile name", autocompletion=complete_profile
305
- ),
306
- format: str = typer.Option(
307
- "table",
308
- "--format",
309
- "-f",
310
- help="Output format (table, json, csv)",
311
- autocompletion=complete_output_format,
312
- ),
313
- output: Optional[str] = typer.Option(
314
- None, "--output", "-o", help="Output file path"
315
- ),
316
- ):
317
- """Get multiple spaces in a single request (max 1000)."""
318
- try:
319
- service = SpaceService(profile=profile)
320
-
321
- with SpinnerProgressTracker().track_spinner(
322
- f"Fetching {len(space_rids)} spaces..."
323
- ):
324
- spaces = service.get_spaces_batch(space_rids)
325
-
326
- # Cache RIDs for future completions
327
- for space in spaces:
328
- if space.get("rid"):
329
- cache_rid(space["rid"])
330
-
331
- # Format output
332
- if format == "json":
333
- if output:
334
- formatter.save_to_file(spaces, output, "json")
335
- else:
336
- formatter.format_list(spaces)
337
- elif format == "csv":
338
- if output:
339
- formatter.save_to_file(spaces, output, "csv")
340
- else:
341
- formatter.format_list(spaces)
342
- else:
343
- _format_spaces_table(spaces)
344
-
345
- if output:
346
- formatter.print_success(f"Spaces information saved to {output}")
347
-
348
- except (ProfileNotFoundError, MissingCredentialsError) as e:
349
- formatter.print_error(f"Authentication error: {e}")
350
- raise typer.Exit(1)
351
- except ValueError as e:
352
- formatter.print_error(f"Invalid request: {e}")
353
- raise typer.Exit(1)
354
- except Exception as e:
355
- formatter.print_error(f"Failed to get spaces batch: {e}")
356
- raise typer.Exit(1)
357
-
358
-
359
- @app.command("list-members")
360
- def list_space_members(
361
- space_rid: str = typer.Argument(
362
- ..., help="Space Resource Identifier", autocompletion=complete_rid
363
- ),
364
- principal_type: Optional[str] = typer.Option(
365
- None,
366
- "--principal-type",
367
- "-t",
368
- help="Filter by principal type (User or Group)",
369
- ),
370
- profile: Optional[str] = typer.Option(
371
- None, "--profile", help="Profile name", autocompletion=complete_profile
372
- ),
373
- format: str = typer.Option(
374
- "table",
375
- "--format",
376
- "-f",
377
- help="Output format (table, json, csv)",
378
- autocompletion=complete_output_format,
379
- ),
380
- output: Optional[str] = typer.Option(
381
- None, "--output", "-o", help="Output file path"
382
- ),
383
- page_size: Optional[int] = typer.Option(
384
- None, "--page-size", help="Number of items per page"
385
- ),
386
- ):
387
- """Get all members (users/groups) of a space."""
388
- try:
389
- service = SpaceService(profile=profile)
390
-
391
- filter_desc = f" ({principal_type}s only)" if principal_type else ""
392
- with SpinnerProgressTracker().track_spinner(
393
- f"Listing members of space {space_rid}{filter_desc}..."
394
- ):
395
- members = service.get_space_members(
396
- space_rid=space_rid,
397
- principal_type=principal_type.title() if principal_type else None,
398
- page_size=page_size,
399
- )
400
-
401
- if not members:
402
- formatter.print_info(f"No members found in space {space_rid}.")
403
- return
404
-
405
- # Format output
406
- if format == "json":
407
- if output:
408
- formatter.save_to_file(members, output, "json")
409
- else:
410
- formatter.format_list(members)
411
- elif format == "csv":
412
- if output:
413
- formatter.save_to_file(members, output, "csv")
414
- else:
415
- formatter.format_list(members)
416
- else:
417
- _format_space_members_table(members)
418
-
419
- if output:
420
- formatter.print_success(f"Space members saved to {output}")
421
-
422
- except (ProfileNotFoundError, MissingCredentialsError) as e:
423
- formatter.print_error(f"Authentication error: {e}")
424
- raise typer.Exit(1)
425
- except Exception as e:
426
- formatter.print_error(f"Failed to list space members: {e}")
427
- raise typer.Exit(1)
428
-
429
-
430
- @app.command("add-member")
431
- def add_space_member(
432
- space_rid: str = typer.Argument(
433
- ..., help="Space Resource Identifier", autocompletion=complete_rid
434
- ),
435
- principal_id: str = typer.Option(
436
- ..., "--principal-id", "-p", help="Principal (user/group) identifier"
437
- ),
438
- principal_type: str = typer.Option(
439
- ...,
440
- "--principal-type",
441
- "-t",
442
- help="Principal type (User or Group)",
443
- ),
444
- role_name: str = typer.Option(..., "--role", "-r", help="Role name to grant"),
445
- profile: Optional[str] = typer.Option(
446
- None, "--profile", help="Profile name", autocompletion=complete_profile
447
- ),
448
- format: str = typer.Option(
449
- "table",
450
- "--format",
451
- "-f",
452
- help="Output format (table, json, csv)",
453
- autocompletion=complete_output_format,
454
- ),
455
- ):
456
- """Add a member to a space with a specific role."""
457
- try:
458
- service = SpaceService(profile=profile)
459
-
460
- with SpinnerProgressTracker().track_spinner(
461
- f"Adding {principal_type} '{principal_id}' to space {space_rid} with role '{role_name}'..."
462
- ):
463
- member = service.add_space_member(
464
- space_rid=space_rid,
465
- principal_id=principal_id,
466
- principal_type=principal_type.title(),
467
- role_name=role_name,
468
- )
469
-
470
- formatter.print_success(
471
- f"Successfully added {principal_type} '{principal_id}' to space with role '{role_name}'"
472
- )
473
-
474
- # Format output
475
- if format == "json":
476
- formatter.format_dict(member)
477
- elif format == "csv":
478
- formatter.format_list([member])
479
- else:
480
- _format_space_member_table(member)
481
-
482
- except (ProfileNotFoundError, MissingCredentialsError) as e:
483
- formatter.print_error(f"Authentication error: {e}")
484
- raise typer.Exit(1)
485
- except Exception as e:
486
- formatter.print_error(f"Failed to add space member: {e}")
487
- raise typer.Exit(1)
488
-
489
-
490
- @app.command("remove-member")
491
- def remove_space_member(
492
- space_rid: str = typer.Argument(
493
- ..., help="Space Resource Identifier", autocompletion=complete_rid
494
- ),
495
- principal_id: str = typer.Option(
496
- ..., "--principal-id", "-p", help="Principal (user/group) identifier"
497
- ),
498
- principal_type: str = typer.Option(
499
- ...,
500
- "--principal-type",
501
- "-t",
502
- help="Principal type (User or Group)",
503
- ),
504
- profile: Optional[str] = typer.Option(
505
- None, "--profile", help="Profile name", autocompletion=complete_profile
506
- ),
507
- confirm: bool = typer.Option(False, "--confirm", help="Skip confirmation prompt"),
508
- ):
509
- """Remove a member from a space."""
510
- try:
511
- if not confirm:
512
- confirm_remove = typer.confirm(
513
- f"Are you sure you want to remove {principal_type} '{principal_id}' from space {space_rid}?"
514
- )
515
- if not confirm_remove:
516
- formatter.print_info("Member removal cancelled.")
517
- return
518
-
519
- service = SpaceService(profile=profile)
520
-
521
- with SpinnerProgressTracker().track_spinner(
522
- f"Removing {principal_type} '{principal_id}' from space {space_rid}..."
523
- ):
524
- service.remove_space_member(
525
- space_rid=space_rid,
526
- principal_id=principal_id,
527
- principal_type=principal_type.title(),
528
- )
529
-
530
- formatter.print_success(
531
- f"Successfully removed {principal_type} '{principal_id}' from space"
532
- )
533
-
534
- except (ProfileNotFoundError, MissingCredentialsError) as e:
535
- formatter.print_error(f"Authentication error: {e}")
536
- raise typer.Exit(1)
537
- except Exception as e:
538
- formatter.print_error(f"Failed to remove space member: {e}")
539
- raise typer.Exit(1)
540
-
541
-
542
312
  def _format_space_table(space: dict):
543
313
  """Format space information as a table."""
544
314
  table = Table(title="Space Information", show_header=True, header_style="bold cyan")
@@ -581,57 +351,20 @@ def _format_spaces_table(spaces: List[dict]):
581
351
  console.print(f"\nTotal: {len(spaces)} spaces")
582
352
 
583
353
 
584
- def _format_space_member_table(member: dict):
585
- """Format space member information as a table."""
586
- table = Table(
587
- title="Space Member Information", show_header=True, header_style="bold cyan"
588
- )
589
- table.add_column("Property", style="cyan")
590
- table.add_column("Value")
591
-
592
- table.add_row("Space RID", member.get("space_rid", "N/A"))
593
- table.add_row("Principal ID", member.get("principal_id", "N/A"))
594
- table.add_row("Principal Type", member.get("principal_type", "N/A"))
595
- table.add_row("Role Name", member.get("role_name", "N/A"))
596
- table.add_row("Added By", member.get("added_by", "N/A"))
597
- table.add_row("Added Time", member.get("added_time", "N/A"))
598
-
599
- console.print(table)
600
-
601
-
602
- def _format_space_members_table(members: List[dict]):
603
- """Format multiple space members as a table."""
604
- table = Table(title="Space Members", show_header=True, header_style="bold cyan")
605
- table.add_column("Principal Type")
606
- table.add_column("Principal ID")
607
- table.add_column("Role Name")
608
- table.add_column("Added By")
609
- table.add_column("Added Time")
610
-
611
- for member in members:
612
- table.add_row(
613
- member.get("principal_type", "N/A"),
614
- member.get("principal_id", "N/A"),
615
- member.get("role_name", "N/A"),
616
- member.get("added_by", "N/A"),
617
- member.get("added_time", "N/A"),
618
- )
619
-
620
- console.print(table)
621
- console.print(f"\nTotal: {len(members)} members")
622
-
623
-
624
354
  @app.callback()
625
355
  def main():
626
356
  """
627
357
  Space operations using foundry-platform-sdk.
628
358
 
629
359
  Manage spaces in the Foundry filesystem. Create, retrieve, update, and delete
630
- spaces, and manage space membership using Resource Identifiers (RIDs).
360
+ spaces using Resource Identifiers (RIDs).
631
361
 
632
362
  Examples:
633
- # Create a space in an organization
634
- pltr space create "My Space" --organization-rid ri.compass.main.organization.xyz123
363
+ # Create a space with required parameters
364
+ pltr space create "My Space" \\
365
+ --enrollment-rid ri.enrollment.main.enrollment.xyz123 \\
366
+ --organization ri.compass.main.organization.abc456 \\
367
+ --deletion-policy-org ri.compass.main.organization.abc456
635
368
 
636
369
  # List all spaces
637
370
  pltr space list
@@ -645,17 +378,6 @@ def main():
645
378
  # Update space
646
379
  pltr space update ri.compass.main.space.abc456 --name "Updated Name"
647
380
 
648
- # List space members
649
- pltr space list-members ri.compass.main.space.abc456
650
-
651
- # Add a user to a space
652
- pltr space add-member ri.compass.main.space.abc456 \\
653
- --principal-id user123 --principal-type User --role viewer
654
-
655
- # Remove a user from a space
656
- pltr space remove-member ri.compass.main.space.abc456 \\
657
- --principal-id user123 --principal-type User
658
-
659
381
  # Delete space
660
382
  pltr space delete ri.compass.main.space.abc456
661
383
  """
pltr/commands/sql.py CHANGED
@@ -42,8 +42,15 @@ def execute_query(
42
42
  fallback_branches: Optional[str] = typer.Option(
43
43
  None, "--fallback-branches", help="Comma-separated list of fallback branch IDs"
44
44
  ),
45
+ preview: bool = typer.Option(
46
+ True,
47
+ "--preview/--no-preview",
48
+ help="Enable preview mode (required for SQL API)",
49
+ ),
45
50
  ) -> None:
46
- """Execute a SQL query and display results."""
51
+ """Execute a SQL query and display results.
52
+
53
+ Note: SQL queries are currently in preview and may be modified or removed at any time."""
47
54
  console = Console()
48
55
  formatter = OutputFormatter()
49
56
 
@@ -62,6 +69,7 @@ def execute_query(
62
69
  fallback_branch_ids=fallback_branch_ids,
63
70
  timeout=timeout,
64
71
  format="table" if output_format in ["table", "csv"] else "json",
72
+ preview=preview,
65
73
  )
66
74
 
67
75
  # Extract results
@@ -92,8 +100,15 @@ def submit_query(
92
100
  fallback_branches: Optional[str] = typer.Option(
93
101
  None, "--fallback-branches", help="Comma-separated list of fallback branch IDs"
94
102
  ),
103
+ preview: bool = typer.Option(
104
+ True,
105
+ "--preview/--no-preview",
106
+ help="Enable preview mode (required for SQL API)",
107
+ ),
95
108
  ) -> None:
96
- """Submit a SQL query without waiting for completion."""
109
+ """Submit a SQL query without waiting for completion.
110
+
111
+ Note: SQL queries are currently in preview and may be modified or removed at any time."""
97
112
  console = Console()
98
113
  formatter = OutputFormatter()
99
114
 
@@ -108,7 +123,7 @@ def submit_query(
108
123
 
109
124
  with SpinnerProgressTracker().track_spinner("Submitting SQL query..."):
110
125
  result = service.submit_query(
111
- query=query, fallback_branch_ids=fallback_branch_ids
126
+ query=query, fallback_branch_ids=fallback_branch_ids, preview=preview
112
127
  )
113
128
 
114
129
  console.print("[green]Query submitted successfully[/green]")
@@ -136,6 +151,11 @@ def get_query_status(
136
151
  profile: Optional[str] = typer.Option(
137
152
  None, "--profile", help="Auth profile to use"
138
153
  ),
154
+ preview: bool = typer.Option(
155
+ True,
156
+ "--preview/--no-preview",
157
+ help="Enable preview mode (required for SQL API)",
158
+ ),
139
159
  ) -> None:
140
160
  """Get the status of a submitted query."""
141
161
  console = Console()
@@ -145,7 +165,7 @@ def get_query_status(
145
165
  service = SqlService(profile=profile)
146
166
 
147
167
  with SpinnerProgressTracker().track_spinner("Checking query status..."):
148
- result = service.get_query_status(query_id)
168
+ result = service.get_query_status(query_id, preview=preview)
149
169
 
150
170
  console.print(f"Query ID: [bold]{query_id}[/bold]")
151
171
 
@@ -183,6 +203,11 @@ def get_query_results(
183
203
  output_file: Optional[Path] = typer.Option(
184
204
  None, "--output", help="Save results to file"
185
205
  ),
206
+ preview: bool = typer.Option(
207
+ True,
208
+ "--preview/--no-preview",
209
+ help="Enable preview mode (required for SQL API)",
210
+ ),
186
211
  ) -> None:
187
212
  """Get the results of a completed query."""
188
213
  console = Console()
@@ -195,6 +220,7 @@ def get_query_results(
195
220
  result = service.get_query_results(
196
221
  query_id,
197
222
  format="table" if output_format in ["table", "csv"] else "json",
223
+ preview=preview,
198
224
  )
199
225
 
200
226
  # Display or save results
@@ -217,6 +243,11 @@ def cancel_query(
217
243
  profile: Optional[str] = typer.Option(
218
244
  None, "--profile", help="Auth profile to use"
219
245
  ),
246
+ preview: bool = typer.Option(
247
+ True,
248
+ "--preview/--no-preview",
249
+ help="Enable preview mode (required for SQL API)",
250
+ ),
220
251
  ) -> None:
221
252
  """Cancel a running query."""
222
253
  console = Console()
@@ -226,7 +257,7 @@ def cancel_query(
226
257
  service = SqlService(profile=profile)
227
258
 
228
259
  with SpinnerProgressTracker().track_spinner("Canceling query..."):
229
- result = service.cancel_query(query_id)
260
+ result = service.cancel_query(query_id, preview=preview)
230
261
 
231
262
  console.print(f"Query ID: [bold]{query_id}[/bold]")
232
263
 
@@ -259,8 +290,15 @@ def export_query_results(
259
290
  fallback_branches: Optional[str] = typer.Option(
260
291
  None, "--fallback-branches", help="Comma-separated list of fallback branch IDs"
261
292
  ),
293
+ preview: bool = typer.Option(
294
+ True,
295
+ "--preview/--no-preview",
296
+ help="Enable preview mode (required for SQL API)",
297
+ ),
262
298
  ) -> None:
263
- """Execute a SQL query and export results to a file."""
299
+ """Execute a SQL query and export results to a file.
300
+
301
+ Note: SQL queries are currently in preview and may be modified or removed at any time."""
264
302
  console = Console()
265
303
  formatter = OutputFormatter()
266
304
 
@@ -289,6 +327,7 @@ def export_query_results(
289
327
  fallback_branch_ids=fallback_branch_ids,
290
328
  timeout=timeout,
291
329
  format="table" if output_format in ["table", "csv"] else "json",
330
+ preview=preview,
292
331
  )
293
332
 
294
333
  # Save results to file
@@ -321,6 +360,11 @@ def wait_for_query(
321
360
  output_file: Optional[Path] = typer.Option(
322
361
  None, "--output", help="Save results to file when completed"
323
362
  ),
363
+ preview: bool = typer.Option(
364
+ True,
365
+ "--preview/--no-preview",
366
+ help="Enable preview mode (required for SQL API)",
367
+ ),
324
368
  ) -> None:
325
369
  """Wait for a query to complete and optionally display results."""
326
370
  console = Console()
@@ -330,7 +374,9 @@ def wait_for_query(
330
374
  service = SqlService(profile=profile)
331
375
 
332
376
  with SpinnerProgressTracker().track_spinner("Waiting for query to complete..."):
333
- status_result = service.wait_for_completion(query_id, timeout)
377
+ status_result = service.wait_for_completion(
378
+ query_id, timeout, preview=preview
379
+ )
334
380
 
335
381
  console.print(f"Query ID: [bold]{query_id}[/bold]")
336
382
  console.print(
@@ -343,6 +389,7 @@ def wait_for_query(
343
389
  result = service.get_query_results(
344
390
  query_id,
345
391
  format="table" if output_format in ["table", "csv"] else "json",
392
+ preview=preview,
346
393
  )
347
394
 
348
395
  if output_file: