peak-sdk 1.5.0__py3-none-any.whl → 1.7.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 +80 -5
- peak/_version.py +1 -1
- peak/cli/args.py +1 -0
- peak/cli/cli.py +3 -2
- peak/cli/helpers.py +1 -0
- peak/cli/press/apps/specs.py +2 -0
- peak/cli/press/blocks/specs.py +68 -24
- peak/cli/press/deployments.py +41 -0
- peak/cli/press/specs.py +4 -2
- peak/cli/resources/alerts/__init__.py +35 -0
- peak/cli/resources/alerts/emails.py +360 -0
- peak/cli/resources/images.py +19 -7
- peak/cli/resources/services.py +23 -0
- peak/cli/resources/tenants.py +4 -1
- peak/cli/resources/workflows.py +81 -19
- peak/cli/ruff.toml +5 -3
- peak/compression.py +2 -2
- peak/exceptions.py +4 -6
- peak/handler.py +3 -5
- peak/helpers.py +8 -9
- peak/output.py +2 -2
- peak/press/apps.py +18 -19
- peak/press/blocks.py +396 -155
- peak/press/deployments.py +30 -4
- peak/press/specs.py +12 -14
- peak/resources/__init__.py +3 -2
- peak/resources/alerts.py +309 -0
- peak/resources/artifacts.py +2 -4
- peak/resources/images.py +317 -100
- peak/resources/services.py +7 -6
- peak/resources/webapps.py +3 -5
- peak/resources/workflows.py +103 -13
- peak/sample_yaml/press/apps/specs/create_app_spec.yaml +2 -0
- peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml +2 -0
- peak/sample_yaml/press/blocks/specs/service/api/create_block_spec.yaml +102 -0
- peak/sample_yaml/press/blocks/specs/service/api/create_block_spec_release.yaml +88 -0
- peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec.yaml +103 -0
- peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec_release.yaml +89 -0
- peak/sample_yaml/press/blocks/specs/{create_block_spec.yaml → workflow/create_block_spec.yaml} +20 -1
- peak/sample_yaml/press/blocks/specs/{create_block_spec_release.yaml → workflow/create_block_spec_release.yaml} +20 -1
- peak/sample_yaml/resources/emails/send_email.yaml +15 -0
- peak/sample_yaml/resources/images/dockerfile/create_image.yaml +3 -0
- peak/sample_yaml/resources/images/dockerfile/create_image_version.yaml +3 -0
- peak/sample_yaml/resources/images/dockerfile/update_version.yaml +3 -0
- peak/sample_yaml/resources/images/github/create_image.yaml +3 -0
- peak/sample_yaml/resources/images/github/create_image_version.yaml +3 -0
- peak/sample_yaml/resources/images/github/update_version.yaml +3 -0
- peak/sample_yaml/resources/images/upload/create_image.yaml +3 -0
- peak/sample_yaml/resources/images/upload/create_image_version.yaml +3 -0
- peak/sample_yaml/resources/images/upload/create_or_update_image.yaml +3 -0
- peak/sample_yaml/resources/images/upload/update_version.yaml +3 -0
- peak/sample_yaml/resources/services/create_or_update_service.yaml +1 -0
- peak/sample_yaml/resources/services/create_service.yaml +1 -0
- peak/sample_yaml/resources/services/update_service.yaml +1 -0
- peak/sample_yaml/resources/workflows/create_or_update_workflow.yaml +36 -0
- peak/sample_yaml/resources/workflows/create_workflow.yaml +19 -1
- peak/sample_yaml/resources/workflows/patch_workflow.yaml +36 -0
- peak/sample_yaml/resources/workflows/update_workflow.yaml +36 -0
- peak/session.py +1 -1
- peak/telemetry.py +1 -1
- peak/template.py +6 -4
- peak/tools/logging/__init__.py +26 -268
- peak/tools/logging/log_level.py +35 -3
- peak/tools/logging/logger.py +389 -0
- {peak_sdk-1.5.0.dist-info → peak_sdk-1.7.0.dist-info}/METADATA +19 -20
- {peak_sdk-1.5.0.dist-info → peak_sdk-1.7.0.dist-info}/RECORD +69 -60
- {peak_sdk-1.5.0.dist-info → peak_sdk-1.7.0.dist-info}/WHEEL +1 -1
- {peak_sdk-1.5.0.dist-info → peak_sdk-1.7.0.dist-info}/LICENSE +0 -0
- {peak_sdk-1.5.0.dist-info → peak_sdk-1.7.0.dist-info}/entry_points.txt +0 -0
peak/_metadata.py
CHANGED
@@ -24,13 +24,14 @@ The metadata represents the following:
|
|
24
24
|
- table_params: Parameters required for the table output formatting.
|
25
25
|
- request_body_yaml_path: File containing the yaml file examples for the command.
|
26
26
|
"""
|
27
|
+
|
28
|
+
from __future__ import annotations
|
29
|
+
|
27
30
|
from typing import Any, Dict, List
|
28
31
|
|
29
32
|
|
30
33
|
def tag_parser(data: Any) -> str:
|
31
|
-
tag_array = []
|
32
|
-
for tag in data:
|
33
|
-
tag_array.append(tag["name"])
|
34
|
+
tag_array = [tag["name"] for tag in data]
|
34
35
|
return ", ".join(tag_array)
|
35
36
|
|
36
37
|
|
@@ -594,6 +595,26 @@ command_metadata: Dict[str, Any] = {
|
|
594
595
|
"subheader_key": "revisionCount",
|
595
596
|
},
|
596
597
|
},
|
598
|
+
"execute_resources": {
|
599
|
+
"table_params": {
|
600
|
+
"output_keys": {
|
601
|
+
"blockSpecId": {
|
602
|
+
"label": "Block Spec ID",
|
603
|
+
},
|
604
|
+
"version": {
|
605
|
+
"label": "Version",
|
606
|
+
},
|
607
|
+
"executionId": {
|
608
|
+
"label": "Execution ID",
|
609
|
+
},
|
610
|
+
"status": {
|
611
|
+
"label": "Execution Status",
|
612
|
+
},
|
613
|
+
},
|
614
|
+
"title": "Trigger Resources",
|
615
|
+
"data_key": "executeResponse",
|
616
|
+
},
|
617
|
+
},
|
597
618
|
"list_tenant_instance_options": {
|
598
619
|
"table_params": {
|
599
620
|
"output_keys": {
|
@@ -623,6 +644,57 @@ command_metadata: Dict[str, Any] = {
|
|
623
644
|
"data_key": "data",
|
624
645
|
},
|
625
646
|
},
|
647
|
+
"list_emails": {
|
648
|
+
"table_params": {
|
649
|
+
"output_keys": {
|
650
|
+
"id": {
|
651
|
+
"label": "ID",
|
652
|
+
},
|
653
|
+
"subject": {
|
654
|
+
"label": "Subject",
|
655
|
+
},
|
656
|
+
"status": {
|
657
|
+
"label": "Status",
|
658
|
+
},
|
659
|
+
"templateName": {
|
660
|
+
"label": "Template Name",
|
661
|
+
},
|
662
|
+
"createdAt": {
|
663
|
+
"label": "Created At",
|
664
|
+
},
|
665
|
+
"createdBy": {
|
666
|
+
"label": "Created By",
|
667
|
+
},
|
668
|
+
},
|
669
|
+
"title": "Emails",
|
670
|
+
"data_key": "emails",
|
671
|
+
"subheader_key": "emailCount",
|
672
|
+
},
|
673
|
+
},
|
674
|
+
"list_templates": {
|
675
|
+
"table_params": {
|
676
|
+
"output_keys": {
|
677
|
+
"id": {
|
678
|
+
"label": "ID",
|
679
|
+
},
|
680
|
+
"name": {
|
681
|
+
"label": "Name",
|
682
|
+
},
|
683
|
+
"scope": {
|
684
|
+
"label": "Status",
|
685
|
+
},
|
686
|
+
"createdAt": {
|
687
|
+
"label": "Created At",
|
688
|
+
},
|
689
|
+
"createdBy": {
|
690
|
+
"label": "Created By",
|
691
|
+
},
|
692
|
+
},
|
693
|
+
"title": "Templates",
|
694
|
+
"data_key": "templates",
|
695
|
+
"subheader_key": "templateCount",
|
696
|
+
},
|
697
|
+
},
|
626
698
|
"create_artifact": {
|
627
699
|
"request_body_yaml_path": "sample_yaml/resources/artifacts/create_artifact.yaml",
|
628
700
|
},
|
@@ -680,6 +752,9 @@ command_metadata: Dict[str, Any] = {
|
|
680
752
|
"test_service": {
|
681
753
|
"request_body_yaml_path": "sample_yaml/resources/services/test_service.yaml",
|
682
754
|
},
|
755
|
+
"send_email": {
|
756
|
+
"request_body_yaml_path": "sample_yaml/resources/emails/send_email.yaml",
|
757
|
+
},
|
683
758
|
"create_app_spec": {
|
684
759
|
"request_body_yaml_path": "sample_yaml/press/apps/specs/create_app_spec.yaml",
|
685
760
|
},
|
@@ -699,13 +774,13 @@ command_metadata: Dict[str, Any] = {
|
|
699
774
|
"request_body_yaml_path": "sample_yaml/press/apps/deployments/update_app_deployment_metadata.yaml",
|
700
775
|
},
|
701
776
|
"create_block_spec": {
|
702
|
-
"request_body_yaml_path": "sample_yaml/press/blocks/specs/create_block_spec.yaml",
|
777
|
+
"request_body_yaml_path": "sample_yaml/press/blocks/specs/workflow/create_block_spec.yaml",
|
703
778
|
},
|
704
779
|
"update_block_spec_metadata": {
|
705
780
|
"request_body_yaml_path": "sample_yaml/press/blocks/specs/update_block_spec_metadata.yaml",
|
706
781
|
},
|
707
782
|
"create_block_spec_release": {
|
708
|
-
"request_body_yaml_path": "sample_yaml/press/blocks/specs/create_block_spec_release.yaml",
|
783
|
+
"request_body_yaml_path": "sample_yaml/press/blocks/specs/workflow/create_block_spec_release.yaml",
|
709
784
|
},
|
710
785
|
"create_block_deployment": {
|
711
786
|
"request_body_yaml_path": "sample_yaml/press/blocks/deployments/create_block_deployment.yaml",
|
peak/_version.py
CHANGED
peak/cli/args.py
CHANGED
peak/cli/cli.py
CHANGED
@@ -25,15 +25,16 @@ import peak.config
|
|
25
25
|
import typer
|
26
26
|
from peak.cli import args, helpers
|
27
27
|
from peak.cli.press import apps, blocks, deployments, specs
|
28
|
-
from peak.cli.resources import artifacts, images, services, tenants, users, webapps, workflows
|
28
|
+
from peak.cli.resources import alerts, artifacts, images, services, tenants, users, webapps, workflows
|
29
29
|
from peak.constants import Sources
|
30
30
|
from peak.output import Writer
|
31
31
|
|
32
|
-
#
|
32
|
+
# Workaround to not gray out texts after first paragraph
|
33
33
|
typer.rich_utils.STYLE_HELPTEXT = ""
|
34
34
|
|
35
35
|
typer_app = typer.Typer(rich_markup_mode="markdown", help="Create and Manage Peak Resources")
|
36
36
|
typer_app.add_typer(images.app, name="images")
|
37
|
+
typer_app.add_typer(alerts.app, name="alerts")
|
37
38
|
typer_app.add_typer(artifacts.app, name="artifacts")
|
38
39
|
typer_app.add_typer(workflows.app, name="workflows")
|
39
40
|
typer_app.add_typer(webapps.app, name="webapps")
|
peak/cli/helpers.py
CHANGED
@@ -252,5 +252,6 @@ def get_client(command: str) -> base_client.BaseClient:
|
|
252
252
|
"webapps": resources.webapps,
|
253
253
|
"tenants": resources.tenants,
|
254
254
|
"users": resources.users,
|
255
|
+
"alerts": resources.alerts,
|
255
256
|
}
|
256
257
|
return command_client_map[command].get_client() # type: ignore[no-any-return]
|
peak/cli/press/apps/specs.py
CHANGED
@@ -74,6 +74,7 @@ def create(
|
|
74
74
|
- id (string): ID of the block spec.
|
75
75
|
release (map):
|
76
76
|
version (string): A valid semantic release version of the block spec.
|
77
|
+
autoRunOnDeploy (bool | required: false): Whether to execute the resource after the app is deployed. By default it is False.
|
77
78
|
```
|
78
79
|
|
79
80
|
\b
|
@@ -318,6 +319,7 @@ def create_release(
|
|
318
319
|
- id (string): ID of the block spec.
|
319
320
|
release (map):
|
320
321
|
version (string): A valid semantic release version of the block spec.
|
322
|
+
autoRunOnDeploy (bool | required: false): Whether to execute the resource after the app is deployed. By default it is False.
|
321
323
|
```
|
322
324
|
|
323
325
|
\b
|
peak/cli/press/blocks/specs.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
|
"""Peak blocks specs commands."""
|
22
|
+
|
22
23
|
from typing import Dict, List, Optional
|
23
24
|
|
24
25
|
import typer
|
@@ -109,6 +110,7 @@ def create(
|
|
109
110
|
featured (bool | required: false): Boolean specifying whether to feature this spec.
|
110
111
|
scope (str | required: false): Specify what tenants can discover and deploy this spec.
|
111
112
|
tenants (list(str) | required: false): Given a shared scope, specify what other tenants can discover and deploy this spec.
|
113
|
+
autoRunOnDeploy (bool | required: false): Whether to execute the resource after the block is deployed. By default it is False.
|
112
114
|
body (map):
|
113
115
|
version (int): Version of the spec.
|
114
116
|
kind (string): Specifies the type of spec.
|
@@ -124,8 +126,8 @@ def create(
|
|
124
126
|
release (map):
|
125
127
|
version (string): A valid semantic release version of the spec.
|
126
128
|
notes (string | required: false): Notes for the release version.
|
127
|
-
config (map):
|
128
|
-
images(map | required: false):
|
129
|
+
config (map): # For Workflow Block
|
130
|
+
images(map | required: false):
|
129
131
|
image-name (map): Dictionary containing the image configuration. Here the key is name of the image.
|
130
132
|
version (string | required: false): A valid semantic image version.
|
131
133
|
dockerfile (string | required: false): Path to the Dockerfile inside artifact.
|
@@ -133,7 +135,7 @@ def create(
|
|
133
135
|
useCache (boolean | required: false): Whether to enable image caching to reduce build time, is enabled by default.
|
134
136
|
buildArguments (map | required: false): Dictionary containing build args. Here the key is the name of the arg and value is the value of the arg.
|
135
137
|
secrets (list(str)) | required: false): List of secret names to be passed.
|
136
|
-
steps (map | required: false):
|
138
|
+
steps (map | required: false):
|
137
139
|
<stepName> (map): Dictionary containing the step configuration. Here the key is name of the step.
|
138
140
|
image: (map | required: false):
|
139
141
|
version (string | required: false): A valid semantic image version.
|
@@ -169,25 +171,45 @@ def create(
|
|
169
171
|
- events (map):
|
170
172
|
success (boolean | required: false): Whether to call event on success.
|
171
173
|
fail (boolean | required: false): Whether to call event on failure.
|
172
|
-
runtimeExceeded (int | required: false): The runtime after which event is called.
|
173
|
-
user (string
|
174
|
-
|
174
|
+
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
175
|
+
user (string): User to be notified.
|
176
|
+
- events (map):
|
177
|
+
success (boolean | required: false): Whether to call event on success.
|
178
|
+
fail (boolean | required: false): Whether to call event on failure.
|
179
|
+
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
180
|
+
webhook (map):
|
175
181
|
name (string): Name of the webhook.
|
176
182
|
url (string): URL of the webhook.
|
177
183
|
payload (string): Webhook payload.
|
178
|
-
|
184
|
+
- events (map):
|
185
|
+
success (boolean | required: false): Whether to call event on success.
|
186
|
+
fail (boolean | required: false): Whether to call event on failure.
|
187
|
+
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
188
|
+
email (map):
|
189
|
+
name (string): Name of the email watcher.
|
190
|
+
recipients (map):
|
191
|
+
to (list(str)): List of email addresses to send the email to. Email can be sent only to the users who are added in the tenant.
|
192
|
+
config (map): # For Service Block. One of "image" or "imageDetails" is required.
|
193
|
+
serviceType (string): Type of the service. Should be one of "web-app" or "api". It is "web-app" by default.
|
194
|
+
image (map | required: false):
|
179
195
|
version (string | required: false): A valid semantic image version.
|
180
196
|
dockerfile (string | required: false): Path to the Dockerfile inside artifact.
|
181
197
|
context (string | required: false): The path within the artifact where the code to be executed by the Dockerfile is located.
|
182
198
|
useCache (boolean | required: false): Whether to enable image caching to reduce build time, is enabled by default.
|
183
199
|
buildArguments (map | required: false): Dictionary containing build args. Here the key is the name of the arg and value is the value of the arg.
|
184
200
|
secrets (list(str)) | required: false): List of secret names to be passed.
|
185
|
-
imageDetails (map | required: false):
|
201
|
+
imageDetails (map | required: false):
|
186
202
|
id (int): ID of the existing image.
|
187
|
-
versionId: (int): ID of the existing image version.
|
188
|
-
resources (map | required: false): To be used only in case of
|
189
|
-
instanceTypeId (int): ID of the instance type to be used in the
|
190
|
-
|
203
|
+
versionId: (int | required: false): ID of the existing image version. If not provided, the latest version will be used.
|
204
|
+
resources (map | required: false): To be used only in case of service block.
|
205
|
+
instanceTypeId (int): ID of the instance type to be used in the service block.
|
206
|
+
parameters (map | required: false):
|
207
|
+
env (map | required: false): Key-Value pair where key is the name of the env.
|
208
|
+
secrets (list(str) | required: false): List of secret names to be passed.
|
209
|
+
sessionStickiness (boolean | required: false): Whether to enable session stickiness for the service. It is false by default. To be used only in case of service block of type web-app.
|
210
|
+
entrypoint (string | required: false): Entry point for the service.
|
211
|
+
healthCheckURL (string | required: false): URL to check the health of the service.
|
212
|
+
minInstances (number | required: false): Minimum number of instances that would run for a service. Default value is 1 and maximum value allowed is 2.
|
191
213
|
parameters (map | required: false):
|
192
214
|
<parameterType> (list(map)): List containing the parameter objects. Here the key is the type of the parameter. Accepted values are "build" or "run".
|
193
215
|
name (string): Name of the parameter.
|
@@ -388,8 +410,8 @@ def create_release(
|
|
388
410
|
release (map):
|
389
411
|
version (string): A valid semantic release version of the spec. Must be greater than previous release version.
|
390
412
|
notes (string | required: false): Notes for the release version.
|
391
|
-
config (map):
|
392
|
-
images(map | required: false):
|
413
|
+
config (map): # For Workflow Block
|
414
|
+
images(map | required: false):
|
393
415
|
image-name(map): Dictionary containing the image configuration. Here the key is name of the image.
|
394
416
|
version (string | required: false): A valid semantic image version.
|
395
417
|
dockerfile (string | required: false): Path to the Dockerfile inside artifact.
|
@@ -397,7 +419,7 @@ def create_release(
|
|
397
419
|
useCache (boolean | required: false): Whether to enable image caching to reduce build time, is enabled by default.
|
398
420
|
buildArguments (map | required: false): Dictionary containing build args. Here the key is the name of the arg and value is the value of the arg.
|
399
421
|
secrets (list(str)) | required: false): List of secret names to be passed.
|
400
|
-
steps(map | required: false):
|
422
|
+
steps(map | required: false):
|
401
423
|
<stepName> (map): Dictionary containing the step configuration. Here the key is name of the step.
|
402
424
|
image: (map | required: false):
|
403
425
|
version (string | required: false): A valid semantic image version.
|
@@ -433,25 +455,45 @@ def create_release(
|
|
433
455
|
- events (map):
|
434
456
|
success (boolean | required: false): Whether to call event on success.
|
435
457
|
fail (boolean | required: false): Whether to call event on failure.
|
436
|
-
runtimeExceeded (int | required: false): The runtime after which event is called.
|
437
|
-
user (string
|
438
|
-
|
458
|
+
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
459
|
+
user (string): User to be notified.
|
460
|
+
- events (map):
|
461
|
+
success (boolean | required: false): Whether to call event on success.
|
462
|
+
fail (boolean | required: false): Whether to call event on failure.
|
463
|
+
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
464
|
+
webhook (map):
|
439
465
|
name (string): Name of the webhook.
|
440
466
|
url (string): URL of the webhook.
|
441
467
|
payload (string): Webhook payload.
|
442
|
-
|
468
|
+
- events (map):
|
469
|
+
success (boolean | required: false): Whether to call event on success.
|
470
|
+
fail (boolean | required: false): Whether to call event on failure.
|
471
|
+
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
472
|
+
email (map):
|
473
|
+
name (string): Name of the email watcher.
|
474
|
+
recipients (map):
|
475
|
+
to (list(str)): List of email addresses to send the email to. Email can be sent only to the users who are added in the tenant.
|
476
|
+
config (map): # For Service Block. One of "image" or "imageDetails" is required.
|
477
|
+
serviceType (string): Type of the service. Should be one of "web-app" or "api". It is "web-app" by default.
|
478
|
+
image (map | required: false):
|
443
479
|
version (string | required: false): A valid semantic image version.
|
444
480
|
dockerfile (string | required: false): Path to the Dockerfile inside artifact.
|
445
481
|
context (string | required: false): The path within the artifact where the code to be executed by the Dockerfile is located.
|
446
482
|
useCache (boolean | required: false): Whether to enable image caching to reduce build time, is enabled by default.
|
447
483
|
buildArguments (map | required: false): Dictionary containing build args. Here the key is the name of the arg and value is the value of the arg.
|
448
484
|
secrets (list(str)) | required: false): List of secret names to be passed.
|
449
|
-
imageDetails (map | required: false):
|
485
|
+
imageDetails (map | required: false):
|
450
486
|
id (int): ID of the existing image.
|
451
|
-
versionId: (int): ID of the existing image version.
|
452
|
-
resources (map | required: false):
|
453
|
-
instanceTypeId (int): ID of the instance type to be used in the
|
454
|
-
|
487
|
+
versionId: (int | required: false): ID of the existing image version. If not provided, the latest version will be used.
|
488
|
+
resources (map | required: false):
|
489
|
+
instanceTypeId (int): ID of the instance type to be used in the service block.
|
490
|
+
parameters (map | required: false):
|
491
|
+
env (map | required: false): Key-Value pair where key is the name of the env.
|
492
|
+
secrets (list(str) | required: false): List of secret names to be passed.
|
493
|
+
sessionStickiness (boolean | required: false): Whether to enable session stickiness for the service. It is false by default. To be used only in case of service block of type web-app.
|
494
|
+
entrypoint (string | required: false): Entry point for the service.
|
495
|
+
healthCheckURL (string | required: false): URL to check the health of the service.
|
496
|
+
minInstances (number | required: false): Minimum number of instances that would run for a service. Default value is 1 and maximum value allowed is 2.
|
455
497
|
parameters (map | required: false):
|
456
498
|
<parameterType> (list(map)): List containing the parameter objects. Here the key is the type of the parameter. Accepted values are "build" or "run".
|
457
499
|
name (string): Name of the parameter.
|
@@ -464,6 +506,7 @@ def create_release(
|
|
464
506
|
artifact (map | required: false):
|
465
507
|
path (str): Path to the artifact.
|
466
508
|
ignore_files (list(str) | required: false) : Ignore files to use when creating artifact.
|
509
|
+
autoRunOnDeploy (bool | required: false): Whether to execute the resource after the block is deployed. By default it is False.
|
467
510
|
```
|
468
511
|
|
469
512
|
\b
|
@@ -534,6 +577,7 @@ def describe_release(
|
|
534
577
|
"createdBy": "someoneh@peak.ai",
|
535
578
|
"id": "df113d64-ff44-4aa0-9278-edb03dae7a3f",
|
536
579
|
"notes": "This is the original release",
|
580
|
+
"autoRunOnDeploy": false,
|
537
581
|
"parameters": {...},
|
538
582
|
}
|
539
583
|
```
|
peak/cli/press/deployments.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
|
"""Peak deployments commands."""
|
22
|
+
|
22
23
|
from typing import List, Optional
|
23
24
|
|
24
25
|
import typer
|
@@ -84,3 +85,43 @@ def list_deployments(
|
|
84
85
|
return_iterator=False,
|
85
86
|
)
|
86
87
|
writer.write(response)
|
88
|
+
|
89
|
+
|
90
|
+
@app.command(short_help="Execute the resources of an app or block deployment", options_metavar="execute_resources")
|
91
|
+
def execute_resources(
|
92
|
+
ctx: typer.Context,
|
93
|
+
deployment_id: str = typer.Argument(..., help="ID of the app or block deployment to execute resources for."),
|
94
|
+
paging: Optional[bool] = PAGING, # noqa: ARG001
|
95
|
+
output_type: Optional[OutputTypes] = OUTPUT_TYPES, # noqa: ARG001
|
96
|
+
) -> None:
|
97
|
+
"""***Execute*** the resources of an app or block deployment. This will execute the resources of the latest revision of the deployment for which `autoRunOnDeploy` property is enabled.
|
98
|
+
|
99
|
+
\b
|
100
|
+
📝 ***Example usage:***<br/>
|
101
|
+
```bash
|
102
|
+
peak deployments execute-resources <deployment_id>
|
103
|
+
```
|
104
|
+
|
105
|
+
\b
|
106
|
+
🆗 ***Response:***
|
107
|
+
```
|
108
|
+
{
|
109
|
+
"executeResponse": [
|
110
|
+
{
|
111
|
+
"blockSpecId": "0bddb4c6-40c5-45c3-b477-fceb2c051609",
|
112
|
+
"version": "1.0.0",
|
113
|
+
"executionId": "a3e77006-86f3-4829-8c43-f21ad462dbbd",
|
114
|
+
"status": "executed"
|
115
|
+
}
|
116
|
+
]
|
117
|
+
}
|
118
|
+
```
|
119
|
+
|
120
|
+
🔗 [**API Documentation**](https://press.peak.ai/api-docs/index.htm#/Deployments/post_v1_deployments__deploymentId__trigger)
|
121
|
+
"""
|
122
|
+
deployment_client: Deployment = ctx.obj["client"]
|
123
|
+
writer: Writer = ctx.obj["writer"]
|
124
|
+
|
125
|
+
with writer.pager():
|
126
|
+
response = deployment_client.execute_resources(deployment_id)
|
127
|
+
writer.write(response)
|
peak/cli/press/specs.py
CHANGED
@@ -35,6 +35,8 @@ app = typer.Typer(
|
|
35
35
|
)
|
36
36
|
console = Console()
|
37
37
|
|
38
|
+
RELEASE_VERSION = typer.Option(None, help="The release version of the spec in valid semantic versioning format.")
|
39
|
+
|
38
40
|
|
39
41
|
@app.command("list", short_help="List App and Block specs.", options_metavar="list_specs")
|
40
42
|
def list_specs(
|
@@ -94,7 +96,7 @@ def list_specs(
|
|
94
96
|
def list_release_deployments(
|
95
97
|
ctx: typer.Context,
|
96
98
|
spec_id: str = args.SPEC_ID,
|
97
|
-
version: str =
|
99
|
+
version: Optional[str] = RELEASE_VERSION,
|
98
100
|
page_size: Optional[int] = args.PAGE_SIZE,
|
99
101
|
page_number: Optional[int] = args.PAGE_NUMBER,
|
100
102
|
status: Optional[List[str]] = args.STATUS_FILTER_SPEC_RELEASES,
|
@@ -104,7 +106,7 @@ def list_release_deployments(
|
|
104
106
|
paging: Optional[bool] = PAGING, # noqa: ARG001
|
105
107
|
output_type: Optional[OutputTypes] = OUTPUT_TYPES, # noqa: ARG001
|
106
108
|
) -> None:
|
107
|
-
"""***List*** all the deployments for a given spec
|
109
|
+
"""***List*** all the deployments for a given spec. Version is optional and if not provided, all deployments for the spec will be returned.
|
108
110
|
|
109
111
|
\b
|
110
112
|
📝 ***Example usage:***<br/>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# # Copyright © 2024 Peak AI Limited. or its affiliates. All Rights Reserved.
|
3
|
+
# #
|
4
|
+
# # Licensed under the Apache License, Version 2.0 (the "License"). You
|
5
|
+
# # may not use this file except in compliance with the License. A copy of
|
6
|
+
# # the License is located at:
|
7
|
+
# #
|
8
|
+
# # https://github.com/PeakBI/peak-sdk/blob/main/LICENSE
|
9
|
+
# #
|
10
|
+
# # or in the "license" file accompanying this file. This file is
|
11
|
+
# # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
12
|
+
# # ANY KIND, either express or implied. See the License for the specific
|
13
|
+
# # language governing permissions and limitations under the License.
|
14
|
+
# #
|
15
|
+
# # This file is part of the peak-sdk.
|
16
|
+
# # see (https://github.com/PeakBI/peak-sdk)
|
17
|
+
# #
|
18
|
+
# # You should have received a copy of the APACHE LICENSE, VERSION 2.0
|
19
|
+
# # along with this program. If not, see <https://apache.org/licenses/LICENSE-2.0>
|
20
|
+
#
|
21
|
+
"""Alerts Module."""
|
22
|
+
|
23
|
+
import typer
|
24
|
+
from peak.cli.resources.alerts import emails
|
25
|
+
|
26
|
+
app = typer.Typer(
|
27
|
+
help="Create and manage peak alerts.",
|
28
|
+
short_help="Create and manage peak alerts.",
|
29
|
+
)
|
30
|
+
app.add_typer(
|
31
|
+
emails.app,
|
32
|
+
name="emails",
|
33
|
+
help="Create and manage peak emails.",
|
34
|
+
short_help="Create and manage peak emails.",
|
35
|
+
)
|