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/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
|
-
|
|
29
|
+
enrollment_rid: str = typer.Option(
|
|
30
30
|
...,
|
|
31
|
-
"--
|
|
32
|
-
"-
|
|
33
|
-
help="
|
|
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
|
-
|
|
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
|
|
360
|
+
spaces using Resource Identifiers (RIDs).
|
|
631
361
|
|
|
632
362
|
Examples:
|
|
633
|
-
# Create a space
|
|
634
|
-
pltr space create "My Space"
|
|
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
|
"""
|