prelude-cli-beta 1401__py3-none-any.whl → 1403__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 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
- def cli(ctx, profile):
30
- ctx.obj = Account.from_keychain(profile=profile)
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
 
@@ -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
- @scm.command("groups")
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
@@ -218,7 +228,7 @@ def list_partner_groups(controller, odata_filter, odata_orderby):
218
228
  )
219
229
 
220
230
 
221
- @scm.command("sync-groups")
231
+ @group.command("sync")
222
232
  @click.argument(
223
233
  "partner",
224
234
  type=click.Choice(
@@ -244,7 +254,17 @@ def sync_groups(controller, partner, instance_id, group_ids):
244
254
  return result
245
255
 
246
256
 
247
- @scm.command("create-threat")
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")
248
268
  @click.argument("name")
249
269
  @click.option(
250
270
  "-d", "--description", help="description of the threat", default=None, type=str
@@ -300,7 +320,7 @@ def create_threat(
300
320
  )
301
321
 
302
322
 
303
- @scm.command("delete-threat")
323
+ @threat.command("delete")
304
324
  @click.argument("threat_id")
305
325
  @click.confirmation_option(prompt="Are you sure?")
306
326
  @click.pass_obj
@@ -311,7 +331,7 @@ def delete_threat(controller, threat_id):
311
331
  return controller.delete_threat(id=threat_id)
312
332
 
313
333
 
314
- @scm.command("threats")
334
+ @threat.command("list")
315
335
  @click.pass_obj
316
336
  @pretty_print
317
337
  def list_threats(controller):
@@ -320,7 +340,7 @@ def list_threats(controller):
320
340
  return controller.list_threats()
321
341
 
322
342
 
323
- @scm.command("threat")
343
+ @threat.command("get")
324
344
  @click.argument("threat_id")
325
345
  @click.pass_obj
326
346
  @pretty_print
@@ -357,64 +377,198 @@ def parse_from_partner_advisory(controller, partner, advisory_id):
357
377
  partner=Control[partner], advisory_id=advisory_id
358
378
  )
359
379
 
360
- @scm.command("list-policy-exceptions")
380
+
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")
361
489
  @click.pass_obj
362
490
  @pretty_print
363
491
  def list_policy_exceptions(controller):
364
492
  """List all policy exceptions"""
365
- with Spinner(description="Querying Policy exceptions"):
493
+ with Spinner(description="Fetching policy exceptions"):
366
494
  return controller.list_policy_exceptions()
367
495
 
368
- @scm.command("update-policy-exception")
496
+
497
+ @policy.command("create")
369
498
  @click.argument(
370
499
  "partner",
371
500
  type=click.Choice(
372
501
  [c.name for c in Control if c != Control.INVALID], case_sensitive=False
373
502
  ),
374
503
  )
375
- @click.option("-e", "--expires", help="Expiry Date (YYYY-MM-DD hh:mm:ss ([+-]hh:mm))", default=None, type=str)
376
504
  @click.option("-i", "--instance_id", required=True, help="instance ID of the partner")
377
- @click.option("-p", "--policy_id", required=True, help="ID of the policy to update")
378
- @click.option("-s", "--settings", required=True, help="Comma separated list of all setting names to be excluded")
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
+ )
379
519
  @click.pass_obj
380
520
  @pretty_print
381
- def update_policy_exception(controller, partner, expires, instance_id, policy_id, settings):
382
- """Update policy exception"""
383
- with Spinner(description=f"Updating Policy exception"):
384
- return controller.put_policy_exceptions(
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(
385
527
  partner=Control[partner],
386
528
  expires=expires,
387
529
  instance_id=instance_id,
388
530
  policy_id=policy_id,
389
- setting_names=settings.split(",") if settings else None
531
+ setting_names=settings.split(",") if settings else None,
390
532
  )
391
533
 
392
- @scm.command("create-policy-exception")
534
+
535
+ @policy.command("update")
393
536
  @click.argument(
394
537
  "partner",
395
538
  type=click.Choice(
396
539
  [c.name for c in Control if c != Control.INVALID], case_sensitive=False
397
540
  ),
398
541
  )
399
- @click.option("-e", "--expires", help="Expiry Date (YYYY-MM-DD hh:mm:ss ([+-]hh:mm))", default=None, type=str)
400
542
  @click.option("-i", "--instance_id", required=True, help="instance ID of the partner")
401
- @click.option("-p", "--policy_id", required=True, help="ID of the policy to create")
402
- @click.option("-s", "--settings", required=True, help="Comma separated list of all setting names to be excluded")
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
+ )
403
555
  @click.pass_obj
404
556
  @pretty_print
405
- def create_policy_exception(controller, partner, expires, instance_id, policy_id, settings):
406
- """Create policy exception"""
407
- with Spinner(description=f"Creating Policy exception"):
408
- return controller.put_policy_exceptions(
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(
409
563
  partner=Control[partner],
410
564
  expires=expires,
411
565
  instance_id=instance_id,
412
566
  policy_id=policy_id,
413
- setting_names=settings.split(",") if settings else None
567
+ setting_names=settings.split(",") if settings else None,
414
568
  )
415
569
 
416
570
 
417
- @scm.command("delete-policy-exception")
571
+ @policy.command("delete")
418
572
  @click.argument(
419
573
  "partner",
420
574
  type=click.Choice(
@@ -427,61 +581,34 @@ def create_policy_exception(controller, partner, expires, instance_id, policy_id
427
581
  @click.pass_obj
428
582
  @pretty_print
429
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
+
430
590
  """Delete policy exception removes all exceptions in a policy"""
431
- with Spinner(description=f"deleting Policy exception"):
591
+ with Spinner(description=f"Deleting policy exception"):
432
592
  return controller.put_policy_exceptions(
433
593
  partner=Control[partner],
434
594
  expires=None,
435
595
  instance_id=instance_id,
436
596
  policy_id=policy_id,
437
- setting_names=[]
597
+ setting_names=[],
438
598
  )
439
599
 
440
- @scm.command("list-object-exceptions")
441
- @click.pass_obj
442
- @pretty_print
443
- def list_object_exceptions(controller):
444
- """List all object exceptions"""
445
- with Spinner(description="Querying Object exceptions"):
446
- return controller.list_object_exceptions()
447
600
 
601
+ @click.group()
602
+ @click.pass_context
603
+ def notification(ctx):
604
+ """SCM notification commands"""
605
+ ctx.obj = ScmController(account=ctx.obj.account)
448
606
 
449
- @scm.command("create-object-exception")
450
- @click.argument("category", type=click.Choice([c.name for c in ControlCategory if c not in [ControlCategory.NONE, ControlCategory.INVALID, ControlCategory.PRIVATE_REPO]], case_sensitive=False))
451
- @click.option("-n", "--name", help="Exception Name", default=None, type=str)
452
- @click.option("-f", "--filter", help="OData filter string", default=None, required=True, type=str)
453
- @click.option("-e", "--expires", help="Expiry Date (YYYY-MM-DD hh:mm:ss ([+-]hh:mm))", default=None, type=str)
454
- @click.pass_obj
455
- @pretty_print
456
- def create_object_exception(controller, category, filter, name, expires):
457
- """Create object exception"""
458
- with Spinner(description=f"Creating Object exception"):
459
- return controller.create_object_exception(category=ControlCategory[category], filter=filter, name=name, expires=expires)
460
607
 
461
- @scm.command("update-object-exception")
462
- @click.option("-i", "--id", help="ID of the exception to update", default=None, type=str)
463
- @click.option("-n", "--name", help="Exception Name", default=None, type=str)
464
- @click.option("-f", "--filter", help="OData filter string", default=None, required=True, type=str)
465
- @click.option("-e", "--expires", help="Expiry Date (YYYY-MM-DD hh:mm:ss ([+-]hh:mm))", default=None, type=str)
466
- @click.pass_obj
467
- @pretty_print
468
- def update_object_exception(controller, id, filter, name, expires):
469
- """Update object exception"""
470
- with Spinner(description=f"Updating Object exception"):
471
- return controller.update_object_exception(exception_id=id, filter=filter, name=name, expires=expires)
472
-
473
- @scm.command("delete-object-exception")
474
- @click.option("-i", "--id", help="ID of the exception to delete", default=None, type=str)
475
- @click.confirmation_option(prompt="Are you sure?")
476
- @click.pass_obj
477
- @pretty_print
478
- def delete_object_exception(controller, id):
479
- """Delete object exception"""
480
- with Spinner(description=f"Delete Object exception"):
481
- return controller.delete_object_exception(exception_id=id)
608
+ scm.add_command(notification)
482
609
 
483
610
 
484
- @scm.command("notifications")
611
+ @notification.command("list")
485
612
  @click.pass_obj
486
613
  @pretty_print
487
614
  def list_notifications(controller):
@@ -489,7 +616,7 @@ def list_notifications(controller):
489
616
  return controller.list_notifications()
490
617
 
491
618
 
492
- @scm.command("delete-notification")
619
+ @notification.command("delete")
493
620
  @click.argument("notification_id", type=str)
494
621
  @click.confirmation_option(prompt="Are you sure?")
495
622
  @click.pass_obj
@@ -499,7 +626,7 @@ def delete_notification(controller, notification_id):
499
626
  return controller.delete_notification(notification_id)
500
627
 
501
628
 
502
- @scm.command("upsert-notification")
629
+ @notification.command("upsert")
503
630
  @click.argument(
504
631
  "control_category",
505
632
  type=click.Choice([c.name for c in ControlCategory], case_sensitive=False),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prelude-cli-beta
3
- Version: 1401
3
+ Version: 1403
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==1401
14
+ Requires-Dist: prelude-sdk-beta==1403
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=FiBYXVT0_Ft6sTAlB00tMfGsRdSHhnNnm0dHWZ06VMU,1289
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=E2esduG4ls-byj7aAXZLM6knBBfGJPIA2ml_8MGmk3c,20195
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-1401.dist-info/licenses/LICENSE,sha256=ttdT5omfN6LNmtQoIjUhkkFhz6i44SDMRNwKrbfyTf8,1069
16
- prelude_cli_beta-1401.dist-info/METADATA,sha256=Q5i1HnrCDuW-F-kyXm0f8zhuOP2rFtsYqbtCy05h-cI,993
17
- prelude_cli_beta-1401.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
- prelude_cli_beta-1401.dist-info/entry_points.txt,sha256=WowrC6fz2D6S8S-5OY0g-bxUGGSZZ_Z6KzSXXd34pC4,88
19
- prelude_cli_beta-1401.dist-info/top_level.txt,sha256=j50aCGsQamLMiQh9PcolDBCAeUJzi9y08e0i9Gqshkk,17
20
- prelude_cli_beta-1401.dist-info/RECORD,,
15
+ prelude_cli_beta-1403.dist-info/licenses/LICENSE,sha256=ttdT5omfN6LNmtQoIjUhkkFhz6i44SDMRNwKrbfyTf8,1069
16
+ prelude_cli_beta-1403.dist-info/METADATA,sha256=zv6HPennwTepfM7gUACgx6f0bvzkgnZU_43SdkxwCmc,993
17
+ prelude_cli_beta-1403.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
+ prelude_cli_beta-1403.dist-info/entry_points.txt,sha256=WowrC6fz2D6S8S-5OY0g-bxUGGSZZ_Z6KzSXXd34pC4,88
19
+ prelude_cli_beta-1403.dist-info/top_level.txt,sha256=j50aCGsQamLMiQh9PcolDBCAeUJzi9y08e0i9Gqshkk,17
20
+ prelude_cli_beta-1403.dist-info/RECORD,,