peak-sdk 1.7.0__py3-none-any.whl → 1.8.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 CHANGED
@@ -36,7 +36,7 @@ def tag_parser(data: Any) -> str:
36
36
 
37
37
 
38
38
  command_metadata: Dict[str, Any] = {
39
- "list_images": {
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
- "list_image_versions": {
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
- "list_image_builds": {
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
- "list_workflows": {
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
- "list_workflow_executions": {
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
- "get_execution_details": {
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
- "list_webapps": {
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
- "list_services": {
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
- "list_artifacts": {
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
- "list_specs": {
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
- "list_release_deployments": {
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
- "list_deployments": {
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
- "list_app_specs": {
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
- "list_app_spec_releases": {
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
- "list_app_deployments": {
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
- "list_app_deployment_revisions": {
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
- "list_block_specs": {
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
- "list_block_spec_releases": {
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
- "list_block_deployments": {
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
- "list_block_deployment_revisions": {
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
- "execute_resources": {
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
- "list_tenant_instance_options": {
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
- "list_emails": {
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
- "list_templates": {
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
- "create_artifact": {
698
+ "artifacts>create": {
699
699
  "request_body_yaml_path": "sample_yaml/resources/artifacts/create_artifact.yaml",
700
700
  },
701
- "update_artifact_metadata": {
701
+ "artifacts>update-metadata": {
702
702
  "request_body_yaml_path": "sample_yaml/resources/artifacts/update_artifact_metadata.yaml",
703
703
  },
704
- "create_artifact_version": {
704
+ "artifacts>create-version": {
705
705
  "request_body_yaml_path": "sample_yaml/resources/artifacts/create_artifact_version.yaml",
706
706
  },
707
- "create_image": {
707
+ "images>create": {
708
708
  "request_body_yaml_path": "sample_yaml/resources/images/upload/create_image.yaml",
709
709
  },
710
- "create_image_version": {
710
+ "images>create-version": {
711
711
  "request_body_yaml_path": "sample_yaml/resources/images/upload/create_image_version.yaml",
712
712
  },
713
- "update_version": {
713
+ "images>update-version": {
714
714
  "request_body_yaml_path": "sample_yaml/resources/images/upload/update_version.yaml",
715
715
  },
716
- "create_or_update_image": {
716
+ "images>create-or-update": {
717
717
  "request_body_yaml_path": "sample_yaml/resources/images/upload/create_or_update_image.yaml",
718
718
  },
719
- "create_workflow": {
719
+ "workflows>create": {
720
720
  "request_body_yaml_path": "sample_yaml/resources/workflows/create_workflow.yaml",
721
721
  },
722
- "update_workflow": {
722
+ "workflows>update": {
723
723
  "request_body_yaml_path": "sample_yaml/resources/workflows/update_workflow.yaml",
724
724
  },
725
- "create_or_update_workflow": {
725
+ "workflows>create-or-update": {
726
726
  "request_body_yaml_path": "sample_yaml/resources/workflows/create_or_update_workflow.yaml",
727
727
  },
728
- "patch_workflow": {
728
+ "workflows>patch": {
729
729
  "request_body_yaml_path": "sample_yaml/resources/workflows/patch_workflow.yaml",
730
730
  },
731
- "execute_workflow": {
731
+ "workflows>execute": {
732
732
  "request_body_yaml_path": "sample_yaml/resources/workflows/execute_workflow.yaml",
733
733
  },
734
- "create_webapp": {
734
+ "webapps>create": {
735
735
  "request_body_yaml_path": "sample_yaml/resources/webapps/create_webapp.yaml",
736
736
  },
737
- "update_webapp": {
737
+ "webapps>update": {
738
738
  "request_body_yaml_path": "sample_yaml/resources/webapps/update_webapp.yaml",
739
739
  },
740
- "create_or_update_webapp": {
740
+ "webapps>create-or-update": {
741
741
  "request_body_yaml_path": "sample_yaml/resources/webapps/create_or_update_webapp.yaml",
742
742
  },
743
- "create_service": {
743
+ "services>create": {
744
744
  "request_body_yaml_path": "sample_yaml/resources/services/create_service.yaml",
745
745
  },
746
- "update_service": {
746
+ "services>update": {
747
747
  "request_body_yaml_path": "sample_yaml/resources/services/update_service.yaml",
748
748
  },
749
- "create_or_update_service": {
749
+ "services>create-or-update": {
750
750
  "request_body_yaml_path": "sample_yaml/resources/services/create_or_update_service.yaml",
751
751
  },
752
- "test_service": {
752
+ "services>test": {
753
753
  "request_body_yaml_path": "sample_yaml/resources/services/test_service.yaml",
754
754
  },
755
- "send_email": {
755
+ "alerts>emails>send": {
756
756
  "request_body_yaml_path": "sample_yaml/resources/emails/send_email.yaml",
757
757
  },
758
- "create_app_spec": {
758
+ "apps>specs>create": {
759
759
  "request_body_yaml_path": "sample_yaml/press/apps/specs/create_app_spec.yaml",
760
760
  },
761
- "update_app_spec_metadata": {
761
+ "apps>specs>update-metadata": {
762
762
  "request_body_yaml_path": "sample_yaml/press/apps/specs/update_app_spec_metadata.yaml",
763
763
  },
764
- "create_app_spec_release": {
764
+ "apps>specs>create-release": {
765
765
  "request_body_yaml_path": "sample_yaml/press/apps/specs/create_app_spec_release.yaml",
766
766
  },
767
- "create_app_deployment": {
767
+ "apps>deployments>create": {
768
768
  "request_body_yaml_path": "sample_yaml/press/apps/deployments/create_app_deployment.yaml",
769
769
  },
770
- "create_app_deployment_revision": {
770
+ "apps>deployments>create-revision": {
771
771
  "request_body_yaml_path": "sample_yaml/press/apps/deployments/create_app_deployment_revision.yaml",
772
772
  },
773
- "update_app_deployment_metadata": {
773
+ "apps>deployments>update-metadata": {
774
774
  "request_body_yaml_path": "sample_yaml/press/apps/deployments/update_app_deployment_metadata.yaml",
775
775
  },
776
- "create_block_spec": {
776
+ "blocks>specs>create": {
777
777
  "request_body_yaml_path": "sample_yaml/press/blocks/specs/workflow/create_block_spec.yaml",
778
778
  },
779
- "update_block_spec_metadata": {
779
+ "blocks>specs>update-metadata": {
780
780
  "request_body_yaml_path": "sample_yaml/press/blocks/specs/update_block_spec_metadata.yaml",
781
781
  },
782
- "create_block_spec_release": {
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
- "create_block_deployment": {
785
+ "blocks>deployments>create": {
786
786
  "request_body_yaml_path": "sample_yaml/press/blocks/deployments/create_block_deployment.yaml",
787
787
  },
788
- "create_block_deployment_revision": {
788
+ "blocks>deployments>create-revision": {
789
789
  "request_body_yaml_path": "sample_yaml/press/blocks/deployments/create_block_deployment_revision.yaml",
790
790
  },
791
- "update_block_deployment_metadata": {
791
+ "blocks>deployments>update-metadata": {
792
792
  "request_body_yaml_path": "sample_yaml/press/blocks/deployments/update_block_deployment_metadata.yaml",
793
793
  },
794
- "patch_block_parameters": {
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
@@ -18,4 +18,4 @@
18
18
  # # You should have received a copy of the APACHE LICENSE, VERSION 2.0
19
19
  # # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
20
20
  #
21
- __version__: str = "1.7.0"
21
+ __version__: str = "1.8.0"
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.command.options_metavar
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.command.options_metavar
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
- description_file: Optional[str] = None,
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
- description: str = ""
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 description_file:
113
- check_file_extension(description_file)
114
- with Path(description_file).open("r") as f:
115
- description = f.read()
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, description)
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]: