peak-sdk 1.7.0__py3-none-any.whl → 1.9.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.
- peak/_metadata.py +57 -57
- peak/_version.py +1 -1
- peak/callbacks.py +22 -2
- peak/cli/args.py +18 -0
- peak/cli/helpers.py +12 -8
- peak/cli/press/apps/deployments.py +72 -18
- peak/cli/press/apps/specs.py +27 -11
- peak/cli/press/blocks/deployments.py +71 -18
- peak/cli/press/blocks/specs.py +29 -13
- peak/cli/press/deployments.py +2 -4
- peak/cli/press/specs.py +2 -2
- peak/cli/resources/alerts/emails.py +4 -5
- peak/cli/resources/artifacts.py +9 -9
- peak/cli/resources/images.py +11 -12
- peak/cli/resources/services.py +6 -7
- peak/cli/resources/tenants.py +53 -4
- peak/cli/resources/users.py +3 -3
- peak/cli/resources/webapps.py +6 -6
- peak/cli/resources/workflows.py +12 -13
- peak/compression.py +28 -13
- peak/exceptions.py +15 -1
- peak/handler.py +5 -1
- peak/helpers.py +38 -0
- peak/output.py +13 -6
- peak/press/apps.py +33 -0
- peak/press/blocks.py +63 -0
- peak/press/deployments.py +0 -3
- peak/resources/tenants.py +37 -2
- peak/template.py +21 -2
- {peak_sdk-1.7.0.dist-info → peak_sdk-1.9.0.dist-info}/METADATA +5 -5
- {peak_sdk-1.7.0.dist-info → peak_sdk-1.9.0.dist-info}/RECORD +34 -34
- {peak_sdk-1.7.0.dist-info → peak_sdk-1.9.0.dist-info}/LICENSE +0 -0
- {peak_sdk-1.7.0.dist-info → peak_sdk-1.9.0.dist-info}/WHEEL +0 -0
- {peak_sdk-1.7.0.dist-info → peak_sdk-1.9.0.dist-info}/entry_points.txt +0 -0
peak/_metadata.py
CHANGED
@@ -36,7 +36,7 @@ def tag_parser(data: Any) -> str:
|
|
36
36
|
|
37
37
|
|
38
38
|
command_metadata: Dict[str, Any] = {
|
39
|
-
"
|
39
|
+
"images>list": {
|
40
40
|
"table_params": {
|
41
41
|
"output_keys": {
|
42
42
|
"id": {
|
@@ -73,7 +73,7 @@ command_metadata: Dict[str, Any] = {
|
|
73
73
|
"subheader_key": "imageCount",
|
74
74
|
},
|
75
75
|
},
|
76
|
-
"
|
76
|
+
"images>list-versions": {
|
77
77
|
"table_params": {
|
78
78
|
"output_keys": {
|
79
79
|
"id": {
|
@@ -104,7 +104,7 @@ command_metadata: Dict[str, Any] = {
|
|
104
104
|
"subheader_key": "versionCount",
|
105
105
|
},
|
106
106
|
},
|
107
|
-
"
|
107
|
+
"images>list-builds": {
|
108
108
|
"table_params": {
|
109
109
|
"output_keys": {
|
110
110
|
"buildId": {
|
@@ -131,7 +131,7 @@ command_metadata: Dict[str, Any] = {
|
|
131
131
|
"subheader_key": "buildCount",
|
132
132
|
},
|
133
133
|
},
|
134
|
-
"
|
134
|
+
"workflows>list": {
|
135
135
|
"table_params": {
|
136
136
|
"output_keys": {
|
137
137
|
"id": {
|
@@ -162,7 +162,7 @@ command_metadata: Dict[str, Any] = {
|
|
162
162
|
"subheader_key": "workflowsCount",
|
163
163
|
},
|
164
164
|
},
|
165
|
-
"
|
165
|
+
"workflows>list-executions": {
|
166
166
|
"table_params": {
|
167
167
|
"output_keys": {
|
168
168
|
"executionId": {
|
@@ -183,7 +183,7 @@ command_metadata: Dict[str, Any] = {
|
|
183
183
|
"subheader_key": "executionsCount",
|
184
184
|
},
|
185
185
|
},
|
186
|
-
"
|
186
|
+
"workflows>get-execution-details": {
|
187
187
|
"table_params": {
|
188
188
|
"output_keys": {
|
189
189
|
"name": {
|
@@ -214,7 +214,7 @@ command_metadata: Dict[str, Any] = {
|
|
214
214
|
"subheader_key": "status",
|
215
215
|
},
|
216
216
|
},
|
217
|
-
"
|
217
|
+
"webapps>list": {
|
218
218
|
"table_params": {
|
219
219
|
"output_keys": {
|
220
220
|
"id": {
|
@@ -242,7 +242,7 @@ command_metadata: Dict[str, Any] = {
|
|
242
242
|
"subheader_key": "webappsCount",
|
243
243
|
},
|
244
244
|
},
|
245
|
-
"
|
245
|
+
"services>list": {
|
246
246
|
"table_params": {
|
247
247
|
"output_keys": {
|
248
248
|
"id": {
|
@@ -273,7 +273,7 @@ command_metadata: Dict[str, Any] = {
|
|
273
273
|
"subheader_key": "servicesCount",
|
274
274
|
},
|
275
275
|
},
|
276
|
-
"
|
276
|
+
"artifacts>list": {
|
277
277
|
"table_params": {
|
278
278
|
"output_keys": {
|
279
279
|
"id": {
|
@@ -297,7 +297,7 @@ command_metadata: Dict[str, Any] = {
|
|
297
297
|
"subheader_key": "artifactCount",
|
298
298
|
},
|
299
299
|
},
|
300
|
-
"
|
300
|
+
"specs>list": {
|
301
301
|
"table_params": {
|
302
302
|
"output_keys": {
|
303
303
|
"id": {
|
@@ -325,7 +325,7 @@ command_metadata: Dict[str, Any] = {
|
|
325
325
|
"subheader_key": "specCount",
|
326
326
|
},
|
327
327
|
},
|
328
|
-
"
|
328
|
+
"specs>list-release-deployments": {
|
329
329
|
"table_params": {
|
330
330
|
"output_keys": {
|
331
331
|
"id": {
|
@@ -356,7 +356,7 @@ command_metadata: Dict[str, Any] = {
|
|
356
356
|
"subheader_key": "deploymentCount",
|
357
357
|
},
|
358
358
|
},
|
359
|
-
"
|
359
|
+
"deployments>list": {
|
360
360
|
"table_params": {
|
361
361
|
"output_keys": {
|
362
362
|
"id": {
|
@@ -387,7 +387,7 @@ command_metadata: Dict[str, Any] = {
|
|
387
387
|
"subheader_key": "deploymentCount",
|
388
388
|
},
|
389
389
|
},
|
390
|
-
"
|
390
|
+
"apps>specs>list": {
|
391
391
|
"table_params": {
|
392
392
|
"output_keys": {
|
393
393
|
"id": {
|
@@ -415,7 +415,7 @@ command_metadata: Dict[str, Any] = {
|
|
415
415
|
"subheader_key": "specCount",
|
416
416
|
},
|
417
417
|
},
|
418
|
-
"
|
418
|
+
"apps>specs>list-releases": {
|
419
419
|
"table_params": {
|
420
420
|
"output_keys": {
|
421
421
|
"id": {
|
@@ -439,7 +439,7 @@ command_metadata: Dict[str, Any] = {
|
|
439
439
|
"subheader_key": "releaseCount",
|
440
440
|
},
|
441
441
|
},
|
442
|
-
"
|
442
|
+
"apps>deployments>list": {
|
443
443
|
"table_params": {
|
444
444
|
"output_keys": {
|
445
445
|
"id": {
|
@@ -470,7 +470,7 @@ command_metadata: Dict[str, Any] = {
|
|
470
470
|
"subheader_key": "deploymentCount",
|
471
471
|
},
|
472
472
|
},
|
473
|
-
"
|
473
|
+
"apps>deployments>list-revisions": {
|
474
474
|
"table_params": {
|
475
475
|
"output_keys": {
|
476
476
|
"id": {
|
@@ -491,7 +491,7 @@ command_metadata: Dict[str, Any] = {
|
|
491
491
|
"subheader_key": "revisionCount",
|
492
492
|
},
|
493
493
|
},
|
494
|
-
"
|
494
|
+
"blocks>specs>list": {
|
495
495
|
"table_params": {
|
496
496
|
"output_keys": {
|
497
497
|
"id": {
|
@@ -519,7 +519,7 @@ command_metadata: Dict[str, Any] = {
|
|
519
519
|
"subheader_key": "specCount",
|
520
520
|
},
|
521
521
|
},
|
522
|
-
"
|
522
|
+
"blocks>specs>list-releases": {
|
523
523
|
"table_params": {
|
524
524
|
"output_keys": {
|
525
525
|
"id": {
|
@@ -543,7 +543,7 @@ command_metadata: Dict[str, Any] = {
|
|
543
543
|
"subheader_key": "releaseCount",
|
544
544
|
},
|
545
545
|
},
|
546
|
-
"
|
546
|
+
"blocks>deployments>list": {
|
547
547
|
"table_params": {
|
548
548
|
"output_keys": {
|
549
549
|
"id": {
|
@@ -574,7 +574,7 @@ command_metadata: Dict[str, Any] = {
|
|
574
574
|
"subheader_key": "deploymentCount",
|
575
575
|
},
|
576
576
|
},
|
577
|
-
"
|
577
|
+
"blocks>deployments>list-revisions": {
|
578
578
|
"table_params": {
|
579
579
|
"output_keys": {
|
580
580
|
"id": {
|
@@ -595,7 +595,7 @@ command_metadata: Dict[str, Any] = {
|
|
595
595
|
"subheader_key": "revisionCount",
|
596
596
|
},
|
597
597
|
},
|
598
|
-
"
|
598
|
+
"deployments>execute-resources": {
|
599
599
|
"table_params": {
|
600
600
|
"output_keys": {
|
601
601
|
"blockSpecId": {
|
@@ -615,7 +615,7 @@ command_metadata: Dict[str, Any] = {
|
|
615
615
|
"data_key": "executeResponse",
|
616
616
|
},
|
617
617
|
},
|
618
|
-
"
|
618
|
+
"tenants>list-instance-options": {
|
619
619
|
"table_params": {
|
620
620
|
"output_keys": {
|
621
621
|
"id": {
|
@@ -644,7 +644,7 @@ command_metadata: Dict[str, Any] = {
|
|
644
644
|
"data_key": "data",
|
645
645
|
},
|
646
646
|
},
|
647
|
-
"
|
647
|
+
"alerts>emails>list": {
|
648
648
|
"table_params": {
|
649
649
|
"output_keys": {
|
650
650
|
"id": {
|
@@ -671,7 +671,7 @@ command_metadata: Dict[str, Any] = {
|
|
671
671
|
"subheader_key": "emailCount",
|
672
672
|
},
|
673
673
|
},
|
674
|
-
"
|
674
|
+
"alerts>emails>list-templates": {
|
675
675
|
"table_params": {
|
676
676
|
"output_keys": {
|
677
677
|
"id": {
|
@@ -695,103 +695,103 @@ command_metadata: Dict[str, Any] = {
|
|
695
695
|
"subheader_key": "templateCount",
|
696
696
|
},
|
697
697
|
},
|
698
|
-
"
|
698
|
+
"artifacts>create": {
|
699
699
|
"request_body_yaml_path": "sample_yaml/resources/artifacts/create_artifact.yaml",
|
700
700
|
},
|
701
|
-
"
|
701
|
+
"artifacts>update-metadata": {
|
702
702
|
"request_body_yaml_path": "sample_yaml/resources/artifacts/update_artifact_metadata.yaml",
|
703
703
|
},
|
704
|
-
"
|
704
|
+
"artifacts>create-version": {
|
705
705
|
"request_body_yaml_path": "sample_yaml/resources/artifacts/create_artifact_version.yaml",
|
706
706
|
},
|
707
|
-
"
|
707
|
+
"images>create": {
|
708
708
|
"request_body_yaml_path": "sample_yaml/resources/images/upload/create_image.yaml",
|
709
709
|
},
|
710
|
-
"
|
710
|
+
"images>create-version": {
|
711
711
|
"request_body_yaml_path": "sample_yaml/resources/images/upload/create_image_version.yaml",
|
712
712
|
},
|
713
|
-
"
|
713
|
+
"images>update-version": {
|
714
714
|
"request_body_yaml_path": "sample_yaml/resources/images/upload/update_version.yaml",
|
715
715
|
},
|
716
|
-
"
|
716
|
+
"images>create-or-update": {
|
717
717
|
"request_body_yaml_path": "sample_yaml/resources/images/upload/create_or_update_image.yaml",
|
718
718
|
},
|
719
|
-
"
|
719
|
+
"workflows>create": {
|
720
720
|
"request_body_yaml_path": "sample_yaml/resources/workflows/create_workflow.yaml",
|
721
721
|
},
|
722
|
-
"
|
722
|
+
"workflows>update": {
|
723
723
|
"request_body_yaml_path": "sample_yaml/resources/workflows/update_workflow.yaml",
|
724
724
|
},
|
725
|
-
"
|
725
|
+
"workflows>create-or-update": {
|
726
726
|
"request_body_yaml_path": "sample_yaml/resources/workflows/create_or_update_workflow.yaml",
|
727
727
|
},
|
728
|
-
"
|
728
|
+
"workflows>patch": {
|
729
729
|
"request_body_yaml_path": "sample_yaml/resources/workflows/patch_workflow.yaml",
|
730
730
|
},
|
731
|
-
"
|
731
|
+
"workflows>execute": {
|
732
732
|
"request_body_yaml_path": "sample_yaml/resources/workflows/execute_workflow.yaml",
|
733
733
|
},
|
734
|
-
"
|
734
|
+
"webapps>create": {
|
735
735
|
"request_body_yaml_path": "sample_yaml/resources/webapps/create_webapp.yaml",
|
736
736
|
},
|
737
|
-
"
|
737
|
+
"webapps>update": {
|
738
738
|
"request_body_yaml_path": "sample_yaml/resources/webapps/update_webapp.yaml",
|
739
739
|
},
|
740
|
-
"
|
740
|
+
"webapps>create-or-update": {
|
741
741
|
"request_body_yaml_path": "sample_yaml/resources/webapps/create_or_update_webapp.yaml",
|
742
742
|
},
|
743
|
-
"
|
743
|
+
"services>create": {
|
744
744
|
"request_body_yaml_path": "sample_yaml/resources/services/create_service.yaml",
|
745
745
|
},
|
746
|
-
"
|
746
|
+
"services>update": {
|
747
747
|
"request_body_yaml_path": "sample_yaml/resources/services/update_service.yaml",
|
748
748
|
},
|
749
|
-
"
|
749
|
+
"services>create-or-update": {
|
750
750
|
"request_body_yaml_path": "sample_yaml/resources/services/create_or_update_service.yaml",
|
751
751
|
},
|
752
|
-
"
|
752
|
+
"services>test": {
|
753
753
|
"request_body_yaml_path": "sample_yaml/resources/services/test_service.yaml",
|
754
754
|
},
|
755
|
-
"
|
755
|
+
"alerts>emails>send": {
|
756
756
|
"request_body_yaml_path": "sample_yaml/resources/emails/send_email.yaml",
|
757
757
|
},
|
758
|
-
"
|
758
|
+
"apps>specs>create": {
|
759
759
|
"request_body_yaml_path": "sample_yaml/press/apps/specs/create_app_spec.yaml",
|
760
760
|
},
|
761
|
-
"
|
761
|
+
"apps>specs>update-metadata": {
|
762
762
|
"request_body_yaml_path": "sample_yaml/press/apps/specs/update_app_spec_metadata.yaml",
|
763
763
|
},
|
764
|
-
"
|
764
|
+
"apps>specs>create-release": {
|
765
765
|
"request_body_yaml_path": "sample_yaml/press/apps/specs/create_app_spec_release.yaml",
|
766
766
|
},
|
767
|
-
"
|
767
|
+
"apps>deployments>create": {
|
768
768
|
"request_body_yaml_path": "sample_yaml/press/apps/deployments/create_app_deployment.yaml",
|
769
769
|
},
|
770
|
-
"
|
770
|
+
"apps>deployments>create-revision": {
|
771
771
|
"request_body_yaml_path": "sample_yaml/press/apps/deployments/create_app_deployment_revision.yaml",
|
772
772
|
},
|
773
|
-
"
|
773
|
+
"apps>deployments>update-metadata": {
|
774
774
|
"request_body_yaml_path": "sample_yaml/press/apps/deployments/update_app_deployment_metadata.yaml",
|
775
775
|
},
|
776
|
-
"
|
776
|
+
"blocks>specs>create": {
|
777
777
|
"request_body_yaml_path": "sample_yaml/press/blocks/specs/workflow/create_block_spec.yaml",
|
778
778
|
},
|
779
|
-
"
|
779
|
+
"blocks>specs>update-metadata": {
|
780
780
|
"request_body_yaml_path": "sample_yaml/press/blocks/specs/update_block_spec_metadata.yaml",
|
781
781
|
},
|
782
|
-
"
|
782
|
+
"blocks>specs>create-release": {
|
783
783
|
"request_body_yaml_path": "sample_yaml/press/blocks/specs/workflow/create_block_spec_release.yaml",
|
784
784
|
},
|
785
|
-
"
|
785
|
+
"blocks>deployments>create": {
|
786
786
|
"request_body_yaml_path": "sample_yaml/press/blocks/deployments/create_block_deployment.yaml",
|
787
787
|
},
|
788
|
-
"
|
788
|
+
"blocks>deployments>create-revision": {
|
789
789
|
"request_body_yaml_path": "sample_yaml/press/blocks/deployments/create_block_deployment_revision.yaml",
|
790
790
|
},
|
791
|
-
"
|
791
|
+
"blocks>deployments>update-metadata": {
|
792
792
|
"request_body_yaml_path": "sample_yaml/press/blocks/deployments/update_block_deployment_metadata.yaml",
|
793
793
|
},
|
794
|
-
"
|
794
|
+
"blocks>deployments>patch-parameters": {
|
795
795
|
"request_body_yaml_path": "sample_yaml/press/blocks/deployments/patch_block_parameters.yaml",
|
796
796
|
},
|
797
797
|
}
|
peak/_version.py
CHANGED
peak/callbacks.py
CHANGED
@@ -19,8 +19,11 @@
|
|
19
19
|
# # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
|
20
20
|
#
|
21
21
|
"""All the Typer callbacks."""
|
22
|
+
from __future__ import annotations
|
23
|
+
|
22
24
|
from pathlib import Path
|
23
25
|
|
26
|
+
import click
|
24
27
|
import typer
|
25
28
|
|
26
29
|
import peak.config
|
@@ -41,11 +44,28 @@ def paging(*, enable_paging: bool) -> None:
|
|
41
44
|
peak.config.ENABLE_PAGING = enable_paging
|
42
45
|
|
43
46
|
|
47
|
+
def get_full_command_name(ctx: typer.Context | click.core.Context | None) -> str:
|
48
|
+
"""Callback to get the full command name."""
|
49
|
+
if ctx:
|
50
|
+
parent = get_full_command_name(ctx.parent)
|
51
|
+
if parent:
|
52
|
+
return f"{parent}>{ctx.info_name}"
|
53
|
+
return str(ctx.info_name)
|
54
|
+
|
55
|
+
return ""
|
56
|
+
|
57
|
+
|
58
|
+
def get_command_name(ctx: typer.Context) -> str:
|
59
|
+
"""Callback to get the parsed command name with first part removed."""
|
60
|
+
command = get_full_command_name(ctx)
|
61
|
+
return ">".join(command.split(">")[1:])
|
62
|
+
|
63
|
+
|
44
64
|
def handle_output(output_type: OutputTypes, ctx: typer.Context) -> None:
|
45
65
|
"""Callback to handle CLI output type and set all the required parameters for Table output."""
|
46
66
|
peak.config.OUTPUT_TYPE = output_type
|
47
67
|
|
48
|
-
command = ctx
|
68
|
+
command = get_command_name(ctx)
|
49
69
|
|
50
70
|
if (command not in command_metadata) or ("table_params" not in command_metadata[command]):
|
51
71
|
return
|
@@ -55,7 +75,7 @@ def handle_output(output_type: OutputTypes, ctx: typer.Context) -> None:
|
|
55
75
|
|
56
76
|
def generate_yaml(ctx: typer.Context, generate_yaml: bool) -> None: # noqa: FBT001 # pragma: no cover
|
57
77
|
"""Callback to generate yaml file."""
|
58
|
-
command = ctx
|
78
|
+
command = get_command_name(ctx)
|
59
79
|
|
60
80
|
if (command not in command_metadata) or ("request_body_yaml_path" not in command_metadata[command]):
|
61
81
|
return
|
peak/cli/args.py
CHANGED
@@ -160,3 +160,21 @@ FILE_NAME = typer.Option(
|
|
160
160
|
None,
|
161
161
|
help="Name or path of the file to save the logs.",
|
162
162
|
)
|
163
|
+
|
164
|
+
RELEASE_NOTES_FILE = typer.Option(
|
165
|
+
None,
|
166
|
+
"--release-notes-file",
|
167
|
+
"-n",
|
168
|
+
help="""
|
169
|
+
Path to the file that defines the release notes for this operation, supports `md`, and `txt` files only.
|
170
|
+
""",
|
171
|
+
)
|
172
|
+
|
173
|
+
REVISION_NOTES_FILE = typer.Option(
|
174
|
+
None,
|
175
|
+
"--revision-notes-file",
|
176
|
+
"-n",
|
177
|
+
help="""
|
178
|
+
Path to the file that defines the revision notes for this operation, supports `md`, and `txt` files only.
|
179
|
+
""",
|
180
|
+
)
|
peak/cli/helpers.py
CHANGED
@@ -19,6 +19,7 @@
|
|
19
19
|
# # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
|
20
20
|
#
|
21
21
|
"""Helper functions for Peak `cli`."""
|
22
|
+
|
22
23
|
from __future__ import annotations
|
23
24
|
|
24
25
|
import inspect
|
@@ -90,33 +91,36 @@ def template_handler(
|
|
90
91
|
file: str,
|
91
92
|
params_file: Optional[str] = None,
|
92
93
|
params: Optional[List[str]] = None,
|
93
|
-
|
94
|
+
markdown_files: Optional[Dict[str, str]] = None,
|
94
95
|
) -> Dict[str, Any]:
|
95
96
|
"""Loads and returns the rendered template.
|
96
97
|
|
97
98
|
Args:
|
98
99
|
file (str): Path to the template file.
|
99
100
|
params_file (Optional[str]): Path to the params map file.
|
100
|
-
description_file: (Optional[str]): Path to the description markdown/text file
|
101
101
|
params (Optional[List[str]]): List of params to override.
|
102
|
+
markdown_files (Optional[Dict[str, str]]): Dictionary of markdown files to load.
|
103
|
+
The key is a colon-separated string representing the nested key path (e.g., "body:metadata:description"), and the value is the path to the markdown file.
|
102
104
|
|
103
105
|
Returns:
|
104
106
|
Dict[str, Any]: Rendered template with values substituted.
|
105
107
|
"""
|
106
108
|
params_dict: Dict[str, Any] = {}
|
107
|
-
|
109
|
+
markdown_data: Dict[str, str] = {}
|
110
|
+
|
108
111
|
if params_file:
|
109
112
|
with Path(params_file).open("r") as f:
|
110
113
|
params_dict = yaml.safe_load(f.read())
|
111
114
|
|
112
|
-
if
|
113
|
-
|
114
|
-
|
115
|
-
|
115
|
+
if markdown_files:
|
116
|
+
for key, value in markdown_files.items():
|
117
|
+
check_file_extension(value)
|
118
|
+
with Path(value).open("r") as f:
|
119
|
+
markdown_data[key] = f.read()
|
116
120
|
|
117
121
|
params_dict = remove_none_values({**params_dict, **parse_params(params)})
|
118
122
|
|
119
|
-
return load_template(file, params_dict,
|
123
|
+
return load_template(file, params_dict, markdown_data=markdown_data, convert_to_snake_case=True)
|
120
124
|
|
121
125
|
|
122
126
|
def remove_unknown_args(args: Dict[str, Any], func: Callable[..., Any]) -> Dict[str, Any]:
|