prelude-cli-beta 1406__py3-none-any.whl → 1407__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.
Potentially problematic release.
This version of prelude-cli-beta might be problematic. Click here for more details.
- prelude_cli_beta/cli.py +7 -2
- prelude_cli_beta/views/scm.py +283 -10
- {prelude_cli_beta-1406.dist-info → prelude_cli_beta-1407.dist-info}/METADATA +2 -2
- {prelude_cli_beta-1406.dist-info → prelude_cli_beta-1407.dist-info}/RECORD +8 -8
- {prelude_cli_beta-1406.dist-info → prelude_cli_beta-1407.dist-info}/WHEEL +0 -0
- {prelude_cli_beta-1406.dist-info → prelude_cli_beta-1407.dist-info}/entry_points.txt +0 -0
- {prelude_cli_beta-1406.dist-info → prelude_cli_beta-1407.dist-info}/licenses/LICENSE +0 -0
- {prelude_cli_beta-1406.dist-info → prelude_cli_beta-1407.dist-info}/top_level.txt +0 -0
prelude_cli_beta/cli.py
CHANGED
|
@@ -26,8 +26,13 @@ def complete_profile(ctx, param, incomplete):
|
|
|
26
26
|
show_default=True,
|
|
27
27
|
shell_complete=complete_profile,
|
|
28
28
|
)
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
@click.option(
|
|
30
|
+
"--resolve_enums",
|
|
31
|
+
is_flag=True,
|
|
32
|
+
help="Resolve enum values to their string representation",
|
|
33
|
+
)
|
|
34
|
+
def cli(ctx, profile, resolve_enums):
|
|
35
|
+
ctx.obj = Account.from_keychain(profile=profile, resolve_enums=resolve_enums)
|
|
31
36
|
if ctx.invoked_subcommand is None:
|
|
32
37
|
click.echo(ctx.get_help())
|
|
33
38
|
|
prelude_cli_beta/views/scm.py
CHANGED
|
@@ -205,7 +205,17 @@ def export(controller, type, output_file, limit, odata_filter, odata_orderby):
|
|
|
205
205
|
return result, f"Exported data to {output_file}"
|
|
206
206
|
|
|
207
207
|
|
|
208
|
-
@
|
|
208
|
+
@click.group()
|
|
209
|
+
@click.pass_context
|
|
210
|
+
def group(ctx):
|
|
211
|
+
"""SCM group commands"""
|
|
212
|
+
ctx.obj = ScmController(account=ctx.obj.account)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
scm.add_command(group)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
@group.command("list")
|
|
209
219
|
@click.option("--odata_filter", help="OData filter string", default=None)
|
|
210
220
|
@click.option("--odata_orderby", help="OData orderby string", default=None)
|
|
211
221
|
@click.pass_obj
|
|
@@ -213,10 +223,12 @@ def export(controller, type, output_file, limit, odata_filter, odata_orderby):
|
|
|
213
223
|
def list_partner_groups(controller, odata_filter, odata_orderby):
|
|
214
224
|
"""List all partner groups"""
|
|
215
225
|
with Spinner(description="Fetching partner groups"):
|
|
216
|
-
return controller.list_partner_groups(
|
|
226
|
+
return controller.list_partner_groups(
|
|
227
|
+
filter=odata_filter, orderby=odata_orderby
|
|
228
|
+
)
|
|
217
229
|
|
|
218
230
|
|
|
219
|
-
@
|
|
231
|
+
@group.command("sync")
|
|
220
232
|
@click.argument(
|
|
221
233
|
"partner",
|
|
222
234
|
type=click.Choice(
|
|
@@ -242,7 +254,17 @@ def sync_groups(controller, partner, instance_id, group_ids):
|
|
|
242
254
|
return result
|
|
243
255
|
|
|
244
256
|
|
|
245
|
-
@
|
|
257
|
+
@click.group()
|
|
258
|
+
@click.pass_context
|
|
259
|
+
def threat(ctx):
|
|
260
|
+
"""SCM threat commands"""
|
|
261
|
+
ctx.obj = ScmController(account=ctx.obj.account)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
scm.add_command(threat)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
@threat.command("create")
|
|
246
268
|
@click.argument("name")
|
|
247
269
|
@click.option(
|
|
248
270
|
"-d", "--description", help="description of the threat", default=None, type=str
|
|
@@ -298,7 +320,7 @@ def create_threat(
|
|
|
298
320
|
)
|
|
299
321
|
|
|
300
322
|
|
|
301
|
-
@
|
|
323
|
+
@threat.command("delete")
|
|
302
324
|
@click.argument("threat_id")
|
|
303
325
|
@click.confirmation_option(prompt="Are you sure?")
|
|
304
326
|
@click.pass_obj
|
|
@@ -309,7 +331,7 @@ def delete_threat(controller, threat_id):
|
|
|
309
331
|
return controller.delete_threat(id=threat_id)
|
|
310
332
|
|
|
311
333
|
|
|
312
|
-
@
|
|
334
|
+
@threat.command("list")
|
|
313
335
|
@click.pass_obj
|
|
314
336
|
@pretty_print
|
|
315
337
|
def list_threats(controller):
|
|
@@ -318,7 +340,7 @@ def list_threats(controller):
|
|
|
318
340
|
return controller.list_threats()
|
|
319
341
|
|
|
320
342
|
|
|
321
|
-
@
|
|
343
|
+
@threat.command("get")
|
|
322
344
|
@click.argument("threat_id")
|
|
323
345
|
@click.pass_obj
|
|
324
346
|
@pretty_print
|
|
@@ -356,7 +378,237 @@ def parse_from_partner_advisory(controller, partner, advisory_id):
|
|
|
356
378
|
)
|
|
357
379
|
|
|
358
380
|
|
|
359
|
-
@
|
|
381
|
+
@click.group()
|
|
382
|
+
@click.pass_context
|
|
383
|
+
def exception(ctx):
|
|
384
|
+
"""SCM exception commands"""
|
|
385
|
+
ctx.obj = ScmController(account=ctx.obj.account)
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
@click.group()
|
|
389
|
+
@click.pass_context
|
|
390
|
+
def object(ctx):
|
|
391
|
+
"""SCM object exception commands"""
|
|
392
|
+
ctx.obj = ScmController(account=ctx.obj.account)
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
@click.group()
|
|
396
|
+
@click.pass_context
|
|
397
|
+
def policy(ctx):
|
|
398
|
+
"""SCM policy exception commands"""
|
|
399
|
+
ctx.obj = ScmController(account=ctx.obj.account)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
exception.add_command(object)
|
|
403
|
+
exception.add_command(policy)
|
|
404
|
+
scm.add_command(exception)
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
@object.command("list")
|
|
408
|
+
@click.pass_obj
|
|
409
|
+
@pretty_print
|
|
410
|
+
def list_object_exceptions(controller):
|
|
411
|
+
"""List all object exceptions"""
|
|
412
|
+
with Spinner(description="Fetching object exceptions"):
|
|
413
|
+
return controller.list_object_exceptions()
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
@object.command("create")
|
|
417
|
+
@click.argument(
|
|
418
|
+
"category",
|
|
419
|
+
type=click.Choice(
|
|
420
|
+
[
|
|
421
|
+
c.name
|
|
422
|
+
for c in ControlCategory
|
|
423
|
+
if c
|
|
424
|
+
not in [
|
|
425
|
+
ControlCategory.NONE,
|
|
426
|
+
ControlCategory.INVALID,
|
|
427
|
+
ControlCategory.PRIVATE_REPO,
|
|
428
|
+
]
|
|
429
|
+
],
|
|
430
|
+
case_sensitive=False,
|
|
431
|
+
),
|
|
432
|
+
)
|
|
433
|
+
@click.option(
|
|
434
|
+
"-f", "--filter", help="OData filter string", default=None, required=True, type=str
|
|
435
|
+
)
|
|
436
|
+
@click.option(
|
|
437
|
+
"-e",
|
|
438
|
+
"--expires",
|
|
439
|
+
help="expiry date (YYYY-MM-DD hh:mm:ss ([+-]hh:mm))",
|
|
440
|
+
default=None,
|
|
441
|
+
type=str,
|
|
442
|
+
)
|
|
443
|
+
@click.option("-n", "--name", help="exception name", default=None, type=str)
|
|
444
|
+
@click.pass_obj
|
|
445
|
+
@pretty_print
|
|
446
|
+
def create_object_exception(controller, category, filter, expires, name):
|
|
447
|
+
"""Create object exception"""
|
|
448
|
+
with Spinner(description=f"Creating object exception"):
|
|
449
|
+
return controller.create_object_exception(
|
|
450
|
+
category=ControlCategory[category],
|
|
451
|
+
filter=filter,
|
|
452
|
+
name=name,
|
|
453
|
+
expires=expires,
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
@object.command("update")
|
|
458
|
+
@click.argument("exception_id", type=str)
|
|
459
|
+
@click.option(
|
|
460
|
+
"-e",
|
|
461
|
+
"--expires",
|
|
462
|
+
help="Expiry Date (YYYY-MM-DD hh:mm:ss ([+-]hh:mm))",
|
|
463
|
+
default=ScmController.default,
|
|
464
|
+
)
|
|
465
|
+
@click.option("-f", "--filter", help="OData filter string", default=None, type=str)
|
|
466
|
+
@click.option("-n", "--name", help="Exception Name", default=None, type=str)
|
|
467
|
+
@click.pass_obj
|
|
468
|
+
@pretty_print
|
|
469
|
+
def update_object_exception(controller, exception_id, expires, filter, name):
|
|
470
|
+
"""Update object exception"""
|
|
471
|
+
with Spinner(description=f"Updating object exception"):
|
|
472
|
+
return controller.update_object_exception(
|
|
473
|
+
exception_id=exception_id, filter=filter, name=name, expires=expires
|
|
474
|
+
)
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
@object.command("delete")
|
|
478
|
+
@click.argument("exception_id", type=str)
|
|
479
|
+
@click.confirmation_option(prompt="Are you sure?")
|
|
480
|
+
@click.pass_obj
|
|
481
|
+
@pretty_print
|
|
482
|
+
def delete_object_exception(controller, exception_id):
|
|
483
|
+
"""Delete object exception"""
|
|
484
|
+
with Spinner(description=f"Delete object exception"):
|
|
485
|
+
return controller.delete_object_exception(exception_id=exception_id)
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
@policy.command("list")
|
|
489
|
+
@click.pass_obj
|
|
490
|
+
@pretty_print
|
|
491
|
+
def list_policy_exceptions(controller):
|
|
492
|
+
"""List all policy exceptions"""
|
|
493
|
+
with Spinner(description="Fetching policy exceptions"):
|
|
494
|
+
return controller.list_policy_exceptions()
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
@policy.command("create")
|
|
498
|
+
@click.argument(
|
|
499
|
+
"partner",
|
|
500
|
+
type=click.Choice(
|
|
501
|
+
[c.name for c in Control if c != Control.INVALID], case_sensitive=False
|
|
502
|
+
),
|
|
503
|
+
)
|
|
504
|
+
@click.option("-i", "--instance_id", required=True, help="instance ID of the partner")
|
|
505
|
+
@click.option("-p", "--policy_id", required=True, help="ID of the policy to create")
|
|
506
|
+
@click.option(
|
|
507
|
+
"-s",
|
|
508
|
+
"--settings",
|
|
509
|
+
required=True,
|
|
510
|
+
help="Comma separated list of all setting names to be excluded",
|
|
511
|
+
)
|
|
512
|
+
@click.option(
|
|
513
|
+
"-e",
|
|
514
|
+
"--expires",
|
|
515
|
+
help="Expiry Date (YYYY-MM-DD hh:mm:ss ([+-]hh:mm))",
|
|
516
|
+
default=None,
|
|
517
|
+
type=str,
|
|
518
|
+
)
|
|
519
|
+
@click.pass_obj
|
|
520
|
+
@pretty_print
|
|
521
|
+
def create_policy_exception(
|
|
522
|
+
controller, partner, instance_id, policy_id, settings, expires
|
|
523
|
+
):
|
|
524
|
+
"""Create policy exception"""
|
|
525
|
+
with Spinner(description=f"Creating policy exception"):
|
|
526
|
+
return controller.create_policy_exceptions(
|
|
527
|
+
partner=Control[partner],
|
|
528
|
+
expires=expires,
|
|
529
|
+
instance_id=instance_id,
|
|
530
|
+
policy_id=policy_id,
|
|
531
|
+
setting_names=settings.split(",") if settings else None,
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
@policy.command("update")
|
|
536
|
+
@click.argument(
|
|
537
|
+
"partner",
|
|
538
|
+
type=click.Choice(
|
|
539
|
+
[c.name for c in Control if c != Control.INVALID], case_sensitive=False
|
|
540
|
+
),
|
|
541
|
+
)
|
|
542
|
+
@click.option("-i", "--instance_id", required=True, help="instance ID of the partner")
|
|
543
|
+
@click.option("-p", "--policy_id", required=True, help="ID of the policy to update")
|
|
544
|
+
@click.option(
|
|
545
|
+
"-e",
|
|
546
|
+
"--expires",
|
|
547
|
+
help="Expiry Date (YYYY-MM-DD hh:mm:ss ([+-]hh:mm))",
|
|
548
|
+
default=ScmController.default,
|
|
549
|
+
)
|
|
550
|
+
@click.option(
|
|
551
|
+
"-s",
|
|
552
|
+
"--settings",
|
|
553
|
+
help="Comma separated list of all setting names to be excluded",
|
|
554
|
+
)
|
|
555
|
+
@click.pass_obj
|
|
556
|
+
@pretty_print
|
|
557
|
+
def update_policy_exception(
|
|
558
|
+
controller, partner, instance_id, policy_id, expires, settings
|
|
559
|
+
):
|
|
560
|
+
"""Update policy exception"""
|
|
561
|
+
with Spinner(description=f"Updating Policy exception"):
|
|
562
|
+
return controller.update_policy_exception(
|
|
563
|
+
partner=Control[partner],
|
|
564
|
+
expires=expires,
|
|
565
|
+
instance_id=instance_id,
|
|
566
|
+
policy_id=policy_id,
|
|
567
|
+
setting_names=settings.split(",") if settings else None,
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
@policy.command("delete")
|
|
572
|
+
@click.argument(
|
|
573
|
+
"partner",
|
|
574
|
+
type=click.Choice(
|
|
575
|
+
[c.name for c in Control if c != Control.INVALID], case_sensitive=False
|
|
576
|
+
),
|
|
577
|
+
)
|
|
578
|
+
@click.option("-i", "--instance_id", required=True, help="instance ID of the partner")
|
|
579
|
+
@click.option("-p", "--policy_id", required=True, help="ID of the policy to be deleted")
|
|
580
|
+
@click.confirmation_option(prompt="Are you sure?")
|
|
581
|
+
@click.pass_obj
|
|
582
|
+
@pretty_print
|
|
583
|
+
def delete_policy_exception(controller, partner, instance_id, policy_id):
|
|
584
|
+
"""Delete policy exception"""
|
|
585
|
+
with Spinner(description=f"Deleting Policy exception"):
|
|
586
|
+
return controller.delete_policy_exception(
|
|
587
|
+
instance_id=instance_id, policy_id=policy_id
|
|
588
|
+
)
|
|
589
|
+
|
|
590
|
+
"""Delete policy exception removes all exceptions in a policy"""
|
|
591
|
+
with Spinner(description=f"Deleting policy exception"):
|
|
592
|
+
return controller.put_policy_exceptions(
|
|
593
|
+
partner=Control[partner],
|
|
594
|
+
expires=None,
|
|
595
|
+
instance_id=instance_id,
|
|
596
|
+
policy_id=policy_id,
|
|
597
|
+
setting_names=[],
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
@click.group()
|
|
602
|
+
@click.pass_context
|
|
603
|
+
def notification(ctx):
|
|
604
|
+
"""SCM notification commands"""
|
|
605
|
+
ctx.obj = ScmController(account=ctx.obj.account)
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
scm.add_command(notification)
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
@notification.command("list")
|
|
360
612
|
@click.pass_obj
|
|
361
613
|
@pretty_print
|
|
362
614
|
def list_notifications(controller):
|
|
@@ -364,7 +616,7 @@ def list_notifications(controller):
|
|
|
364
616
|
return controller.list_notifications()
|
|
365
617
|
|
|
366
618
|
|
|
367
|
-
@
|
|
619
|
+
@notification.command("delete")
|
|
368
620
|
@click.argument("notification_id", type=str)
|
|
369
621
|
@click.confirmation_option(prompt="Are you sure?")
|
|
370
622
|
@click.pass_obj
|
|
@@ -374,7 +626,7 @@ def delete_notification(controller, notification_id):
|
|
|
374
626
|
return controller.delete_notification(notification_id)
|
|
375
627
|
|
|
376
628
|
|
|
377
|
-
@
|
|
629
|
+
@notification.command("upsert")
|
|
378
630
|
@click.argument(
|
|
379
631
|
"control_category",
|
|
380
632
|
type=click.Choice([c.name for c in ControlCategory], case_sensitive=False),
|
|
@@ -469,3 +721,24 @@ def upsert_notification(
|
|
|
469
721
|
teams_urls=teams_urls.split(",") if teams_urls else None,
|
|
470
722
|
title=title,
|
|
471
723
|
)
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
@scm.command("notations")
|
|
727
|
+
@click.pass_obj
|
|
728
|
+
@pretty_print
|
|
729
|
+
def list_notations(controller):
|
|
730
|
+
"""List all notations"""
|
|
731
|
+
with Spinner("Fetching notations"):
|
|
732
|
+
return controller.list_notations()
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
@scm.command("history")
|
|
736
|
+
@click.option("--odata_filter", help="OData filter string", default=None)
|
|
737
|
+
@click.option("--start", type=str, default=None, help="start date")
|
|
738
|
+
@click.option("--end", type=str, default=None, help="end date")
|
|
739
|
+
@click.pass_obj
|
|
740
|
+
@pretty_print
|
|
741
|
+
def list_history(controller, odata_filter, start, end):
|
|
742
|
+
"""List history"""
|
|
743
|
+
with Spinner("Fetching SCM history"):
|
|
744
|
+
return controller.list_history(start, end, filter=odata_filter)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: prelude-cli-beta
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1407
|
|
4
4
|
Summary: For interacting with the Prelude SDK
|
|
5
5
|
Home-page: https://github.com/preludeorg
|
|
6
6
|
Author: Prelude Research
|
|
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: prelude-sdk-beta==
|
|
14
|
+
Requires-Dist: prelude-sdk-beta==1407
|
|
15
15
|
Requires-Dist: click>8
|
|
16
16
|
Requires-Dist: rich
|
|
17
17
|
Requires-Dist: python-dateutil
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
prelude_cli_beta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
prelude_cli_beta/cli.py,sha256=
|
|
2
|
+
prelude_cli_beta/cli.py,sha256=H3JbHuFxb46JbhsLZpH2I_5Vt9airCxUVGhqBAW6lIM,1454
|
|
3
3
|
prelude_cli_beta/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
prelude_cli_beta/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
prelude_cli_beta/views/auth.py,sha256=W-Bc6p3CXpHiQXJCQ4FoB3SdB9xIoeJlV4WMUezSBZ4,1864
|
|
@@ -10,11 +10,11 @@ prelude_cli_beta/views/generate.py,sha256=hfrlmRkb6aSo4LPaPVLhTRUFm8cxZwDqTEjLEP
|
|
|
10
10
|
prelude_cli_beta/views/iam.py,sha256=J8y6kJGbQkEexcia69q6vLJ3aEhLyUFteCylTptBHBQ,10013
|
|
11
11
|
prelude_cli_beta/views/jobs.py,sha256=2FeiJxHrw4zfgtUJq_bEoG84i_9TqZ5w6CulA80WoNA,1455
|
|
12
12
|
prelude_cli_beta/views/partner.py,sha256=16zXcX5ZhiNZqKSXG9ePPGB9K3A-OgrVIdJGDJhB6f0,6379
|
|
13
|
-
prelude_cli_beta/views/scm.py,sha256=
|
|
13
|
+
prelude_cli_beta/views/scm.py,sha256=DKIl9DjVNmShphD5LDHRBP_BLZAbm8CBuU8PI3gUxjY,21617
|
|
14
14
|
prelude_cli_beta/views/shared.py,sha256=ZKvY8N1Vi6RtEbJli5PDzJ9R6L_bX2F27n1tm6Knvgs,1101
|
|
15
|
-
prelude_cli_beta-
|
|
16
|
-
prelude_cli_beta-
|
|
17
|
-
prelude_cli_beta-
|
|
18
|
-
prelude_cli_beta-
|
|
19
|
-
prelude_cli_beta-
|
|
20
|
-
prelude_cli_beta-
|
|
15
|
+
prelude_cli_beta-1407.dist-info/licenses/LICENSE,sha256=ttdT5omfN6LNmtQoIjUhkkFhz6i44SDMRNwKrbfyTf8,1069
|
|
16
|
+
prelude_cli_beta-1407.dist-info/METADATA,sha256=Q_5LBqVGpbz0pFHtUghXGxq9B5GKHeVSbZ7QdKLGjT4,993
|
|
17
|
+
prelude_cli_beta-1407.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
18
|
+
prelude_cli_beta-1407.dist-info/entry_points.txt,sha256=WowrC6fz2D6S8S-5OY0g-bxUGGSZZ_Z6KzSXXd34pC4,88
|
|
19
|
+
prelude_cli_beta-1407.dist-info/top_level.txt,sha256=j50aCGsQamLMiQh9PcolDBCAeUJzi9y08e0i9Gqshkk,17
|
|
20
|
+
prelude_cli_beta-1407.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|