prelude-cli-beta 1441__py3-none-any.whl → 1453__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/views/scm.py +128 -0
- {prelude_cli_beta-1441.dist-info → prelude_cli_beta-1453.dist-info}/METADATA +2 -2
- {prelude_cli_beta-1441.dist-info → prelude_cli_beta-1453.dist-info}/RECORD +7 -7
- {prelude_cli_beta-1441.dist-info → prelude_cli_beta-1453.dist-info}/WHEEL +0 -0
- {prelude_cli_beta-1441.dist-info → prelude_cli_beta-1453.dist-info}/entry_points.txt +0 -0
- {prelude_cli_beta-1441.dist-info → prelude_cli_beta-1453.dist-info}/licenses/LICENSE +0 -0
- {prelude_cli_beta-1441.dist-info → prelude_cli_beta-1453.dist-info}/top_level.txt +0 -0
prelude_cli_beta/views/scm.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import click
|
|
2
|
+
import json
|
|
2
3
|
import requests
|
|
3
4
|
from time import sleep
|
|
4
5
|
|
|
@@ -768,3 +769,130 @@ def list_history(controller, odata_filter, start, end):
|
|
|
768
769
|
"""List history"""
|
|
769
770
|
with Spinner("Fetching SCM history"):
|
|
770
771
|
return controller.list_history(start, end, filter=odata_filter)
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
@click.group()
|
|
775
|
+
@click.pass_context
|
|
776
|
+
def report(ctx):
|
|
777
|
+
"""SCM report commands"""
|
|
778
|
+
ctx.obj = ScmController(account=ctx.obj.account)
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
scm.add_command(report)
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
@report.command("get")
|
|
785
|
+
@click.argument("report_id", type=str)
|
|
786
|
+
@click.pass_obj
|
|
787
|
+
@pretty_print
|
|
788
|
+
def get_report(controller, report_id):
|
|
789
|
+
with Spinner("Fetching report"):
|
|
790
|
+
return controller.get_report(report_id)
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
@report.command("list")
|
|
794
|
+
@click.pass_obj
|
|
795
|
+
@pretty_print
|
|
796
|
+
def list_reports(controller):
|
|
797
|
+
with Spinner("Fetching reports"):
|
|
798
|
+
return controller.list_reports()
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
@report.command("delete")
|
|
802
|
+
@click.argument("report_id", type=str)
|
|
803
|
+
@click.confirmation_option(prompt="Are you sure?")
|
|
804
|
+
@click.pass_obj
|
|
805
|
+
@pretty_print
|
|
806
|
+
def delete_report(controller, report_id):
|
|
807
|
+
with Spinner("Deleting report"):
|
|
808
|
+
return controller.delete_report(report_id)
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
@report.command("put")
|
|
812
|
+
@click.option(
|
|
813
|
+
"--report_data",
|
|
814
|
+
type=str,
|
|
815
|
+
help="report data in JSON format, cannot be used with report_file",
|
|
816
|
+
default=None,
|
|
817
|
+
)
|
|
818
|
+
@click.option(
|
|
819
|
+
"--report_file",
|
|
820
|
+
type=click.Path(exists=True, file_okay=True, dir_okay=False, readable=True),
|
|
821
|
+
help="report data JSON file, will ignore report_data if provided",
|
|
822
|
+
default=None,
|
|
823
|
+
)
|
|
824
|
+
@click.option("--report_id", type=str, help="report ID to update", default=None)
|
|
825
|
+
@click.pass_obj
|
|
826
|
+
@pretty_print
|
|
827
|
+
def put_report(controller, report_data, report_file, report_id):
|
|
828
|
+
if not report_data and not report_file:
|
|
829
|
+
raise ValueError("Either report_data or report_file must be provided")
|
|
830
|
+
|
|
831
|
+
with Spinner("Updating report"):
|
|
832
|
+
if report_file:
|
|
833
|
+
with open(report_file, "r") as f:
|
|
834
|
+
report_data = f.read()
|
|
835
|
+
report_data = json.loads(report_data)
|
|
836
|
+
return controller.put_report(report_data, report_id)
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
@report.command("chart-data")
|
|
840
|
+
@click.argument(
|
|
841
|
+
"scm_category",
|
|
842
|
+
type=click.Choice(
|
|
843
|
+
[c.name for c in SCMCategory if c.value > 0], case_sensitive=False
|
|
844
|
+
),
|
|
845
|
+
)
|
|
846
|
+
@click.option("--group_by", "-b", help="field to group by", required=True, type=str)
|
|
847
|
+
@click.option(
|
|
848
|
+
"--group_limit", "-l", help="max number of groups to return", type=int, default=100
|
|
849
|
+
)
|
|
850
|
+
@click.option(
|
|
851
|
+
"--sort_by",
|
|
852
|
+
"-s",
|
|
853
|
+
help="sort method",
|
|
854
|
+
type=click.Choice(["count_asc", "count_desc", "group_asc", "group_desc"]),
|
|
855
|
+
default="9-0",
|
|
856
|
+
)
|
|
857
|
+
@click.option(
|
|
858
|
+
"--display_overrides",
|
|
859
|
+
"-d",
|
|
860
|
+
help="display overrides in JSON format",
|
|
861
|
+
default=None,
|
|
862
|
+
type=str,
|
|
863
|
+
)
|
|
864
|
+
@click.option(
|
|
865
|
+
"--odata_filter", "-f", help="OData filter string", default=None, type=str
|
|
866
|
+
)
|
|
867
|
+
@click.option(
|
|
868
|
+
"--scopes",
|
|
869
|
+
"-c",
|
|
870
|
+
help="scope-value map in JSON format",
|
|
871
|
+
default=None,
|
|
872
|
+
type=str,
|
|
873
|
+
)
|
|
874
|
+
@click.pass_obj
|
|
875
|
+
@pretty_print
|
|
876
|
+
def get_chart_data(
|
|
877
|
+
controller,
|
|
878
|
+
scm_category,
|
|
879
|
+
group_by,
|
|
880
|
+
group_limit,
|
|
881
|
+
sort_by,
|
|
882
|
+
display_overrides,
|
|
883
|
+
odata_filter,
|
|
884
|
+
scopes,
|
|
885
|
+
):
|
|
886
|
+
"""Get chart data for SCM reports"""
|
|
887
|
+
display_overrides = json.loads(display_overrides) if display_overrides else None
|
|
888
|
+
scopes = json.loads(scopes) if scopes else None
|
|
889
|
+
with Spinner("Fetching chart data"):
|
|
890
|
+
return controller.get_chart_data(
|
|
891
|
+
scm_category=SCMCategory[scm_category],
|
|
892
|
+
group_by=group_by,
|
|
893
|
+
group_limit=group_limit,
|
|
894
|
+
sort_by=sort_by,
|
|
895
|
+
display_overrides=display_overrides,
|
|
896
|
+
odata_filter=odata_filter,
|
|
897
|
+
scopes=scopes,
|
|
898
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: prelude-cli-beta
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1453
|
|
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==1453
|
|
15
15
|
Requires-Dist: click>8
|
|
16
16
|
Requires-Dist: rich
|
|
17
17
|
Requires-Dist: python-dateutil
|
|
@@ -10,11 +10,11 @@ prelude_cli_beta/views/generate.py,sha256=zkdzBaBO7K5tXarnKfzZjo9-WaG5i80y1ZbQk0
|
|
|
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=Rt9ecl6239redsMi6NhQjqsiWw7Z7WsKvjqVAiXYmJM,6085
|
|
13
|
-
prelude_cli_beta/views/scm.py,sha256=
|
|
13
|
+
prelude_cli_beta/views/scm.py,sha256=l83n9Z62ZT7wcCtAo1r40qbPHVOmB_Ro14o3ABEOQgM,25881
|
|
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-1453.dist-info/licenses/LICENSE,sha256=ttdT5omfN6LNmtQoIjUhkkFhz6i44SDMRNwKrbfyTf8,1069
|
|
16
|
+
prelude_cli_beta-1453.dist-info/METADATA,sha256=PRzAP5IQWgK-a-2BWumDxWd7XLZplySu7KoKYa2_j00,993
|
|
17
|
+
prelude_cli_beta-1453.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
18
|
+
prelude_cli_beta-1453.dist-info/entry_points.txt,sha256=WowrC6fz2D6S8S-5OY0g-bxUGGSZZ_Z6KzSXXd34pC4,88
|
|
19
|
+
prelude_cli_beta-1453.dist-info/top_level.txt,sha256=j50aCGsQamLMiQh9PcolDBCAeUJzi9y08e0i9Gqshkk,17
|
|
20
|
+
prelude_cli_beta-1453.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|