peak-sdk 1.6.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.
Files changed (41) hide show
  1. peak/_metadata.py +22 -2
  2. peak/_version.py +1 -1
  3. peak/cli/args.py +1 -0
  4. peak/cli/press/apps/specs.py +2 -0
  5. peak/cli/press/blocks/specs.py +66 -22
  6. peak/cli/press/deployments.py +41 -0
  7. peak/cli/resources/images.py +18 -6
  8. peak/cli/resources/tenants.py +4 -1
  9. peak/cli/resources/workflows.py +12 -12
  10. peak/press/apps.py +10 -3
  11. peak/press/blocks.py +388 -139
  12. peak/press/deployments.py +28 -0
  13. peak/resources/images.py +309 -86
  14. peak/sample_yaml/press/apps/specs/create_app_spec.yaml +2 -0
  15. peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml +2 -0
  16. peak/sample_yaml/press/blocks/specs/service/api/create_block_spec.yaml +102 -0
  17. peak/sample_yaml/press/blocks/specs/service/api/create_block_spec_release.yaml +88 -0
  18. peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec.yaml +103 -0
  19. peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec_release.yaml +89 -0
  20. peak/sample_yaml/press/blocks/specs/{create_block_spec.yaml → workflow/create_block_spec.yaml} +20 -1
  21. peak/sample_yaml/press/blocks/specs/{create_block_spec_release.yaml → workflow/create_block_spec_release.yaml} +20 -1
  22. peak/sample_yaml/resources/images/dockerfile/create_image.yaml +3 -0
  23. peak/sample_yaml/resources/images/dockerfile/create_image_version.yaml +3 -0
  24. peak/sample_yaml/resources/images/dockerfile/update_version.yaml +3 -0
  25. peak/sample_yaml/resources/images/github/create_image.yaml +3 -0
  26. peak/sample_yaml/resources/images/github/create_image_version.yaml +3 -0
  27. peak/sample_yaml/resources/images/github/update_version.yaml +3 -0
  28. peak/sample_yaml/resources/images/upload/create_image.yaml +3 -0
  29. peak/sample_yaml/resources/images/upload/create_image_version.yaml +3 -0
  30. peak/sample_yaml/resources/images/upload/create_or_update_image.yaml +3 -0
  31. peak/sample_yaml/resources/images/upload/update_version.yaml +3 -0
  32. peak/sample_yaml/resources/workflows/create_or_update_workflow.yaml +9 -1
  33. peak/sample_yaml/resources/workflows/create_workflow.yaml +9 -1
  34. peak/sample_yaml/resources/workflows/patch_workflow.yaml +9 -1
  35. peak/sample_yaml/resources/workflows/update_workflow.yaml +9 -1
  36. peak/session.py +1 -1
  37. {peak_sdk-1.6.0.dist-info → peak_sdk-1.7.0.dist-info}/METADATA +14 -14
  38. {peak_sdk-1.6.0.dist-info → peak_sdk-1.7.0.dist-info}/RECORD +41 -37
  39. {peak_sdk-1.6.0.dist-info → peak_sdk-1.7.0.dist-info}/LICENSE +0 -0
  40. {peak_sdk-1.6.0.dist-info → peak_sdk-1.7.0.dist-info}/WHEEL +0 -0
  41. {peak_sdk-1.6.0.dist-info → peak_sdk-1.7.0.dist-info}/entry_points.txt +0 -0
peak/_metadata.py CHANGED
@@ -595,6 +595,26 @@ command_metadata: Dict[str, Any] = {
595
595
  "subheader_key": "revisionCount",
596
596
  },
597
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
+ },
598
618
  "list_tenant_instance_options": {
599
619
  "table_params": {
600
620
  "output_keys": {
@@ -754,13 +774,13 @@ command_metadata: Dict[str, Any] = {
754
774
  "request_body_yaml_path": "sample_yaml/press/apps/deployments/update_app_deployment_metadata.yaml",
755
775
  },
756
776
  "create_block_spec": {
757
- "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",
758
778
  },
759
779
  "update_block_spec_metadata": {
760
780
  "request_body_yaml_path": "sample_yaml/press/blocks/specs/update_block_spec_metadata.yaml",
761
781
  },
762
782
  "create_block_spec_release": {
763
- "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",
764
784
  },
765
785
  "create_block_deployment": {
766
786
  "request_body_yaml_path": "sample_yaml/press/blocks/deployments/create_block_deployment.yaml",
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.6.0"
21
+ __version__: str = "1.7.0"
peak/cli/args.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
  """CLI arguments."""
22
+
22
23
  import typer
23
24
  from peak.callbacks import dry_run, generate_yaml, handle_output, paging
24
25
  from peak.cli.version import display_version
@@ -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
@@ -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): # To be used only in case of workflow block.
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): # To be used only in case of workflow block.
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.
@@ -170,24 +172,44 @@ def create(
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
174
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
173
- user (string | required: false): User to be notified. To be added in case of user watcher.
174
- webhook (map | required: false): To be added in case of webhook watcher.
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
- image (map | required: false): # To be used only in case of webapp block.
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): # To be used only in case of webapp block.
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 webapp block.
189
- instanceTypeId (int): ID of the instance type to be used in the webapp.
190
- sessionStickiness (boolean | required: false): Whether to enable session stickiness for the webapp. It is false by default. To be used only in case of webapp block.
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): # To be used only in case of workflow block.
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): # To be used only in case of workflow block.
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.
@@ -434,24 +456,44 @@ def create_release(
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
458
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
437
- user (string | required: false): User to be notified. To be added in case of user watcher.
438
- webhook (map | required: false): To be added in case of webhook watcher.
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
- image (map | required: false): # To be used only in case of webapp block.
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): # To be used only in case of webapp block.
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): To be used only in case of webapp block.
453
- instanceTypeId (int): ID of the instance type to be used in the webapp.
454
- sessionStickiness (boolean | required: false): Whether to enable session stickiness for the webapp. It is false by default. To be used only in case of webapp block.
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
  ```
@@ -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)
@@ -41,7 +41,10 @@ _BUILD_ID = typer.Option(..., help="ID of the image build to be used in this ope
41
41
 
42
42
  _COUNT = typer.Option(None, help="Number of builds required.")
43
43
 
44
- _BUILD_STATUS = typer.Option(None, help="List of build status to filter image builds.")
44
+ _BUILD_STATUS = typer.Option(
45
+ None,
46
+ help="List of build status to filter image builds. Valid values are `building`, `failed`, `success`, `stopped`, `stopping`.",
47
+ )
45
48
 
46
49
  _VERSIONS = typer.Option(None, help="List of version ids to filter image builds.")
47
50
 
@@ -52,7 +55,10 @@ _IMAGE_LIST_STATUS = typer.Option(
52
55
  help="List of status of the latest version to filter the images by. Valid values are `not-ready`, `ready`, `in-use`, `deleting`, `delete-failed`.",
53
56
  )
54
57
 
55
- _IMAGE_LIST_SCOPE = typer.Option(None, help="List of type of image to filter the images by.")
58
+ _IMAGE_LIST_SCOPE = typer.Option(
59
+ None,
60
+ help="List of type of image to filter the images by. Valid values are `custom` and `global`.",
61
+ )
56
62
 
57
63
  _IMAGE_LIST_BUILD_STATUS = typer.Option(
58
64
  None,
@@ -79,7 +85,10 @@ _NAME = typer.Option(None, help="Name of the image.")
79
85
 
80
86
  _VERSION = typer.Option(None, help="A valid semantic image version.")
81
87
 
82
- _TYPE = typer.Option(None, help="Type of the image.")
88
+ _TYPE = typer.Option(
89
+ None,
90
+ help="Type of the image. Allowed values are 'workflow', 'workspace-r', 'workspace-python, 'api', 'webapp'.",
91
+ )
83
92
 
84
93
  _DESCRIPTION = typer.Option(None, help="Description of the image.")
85
94
 
@@ -89,7 +98,10 @@ _ARTIFACT_IGNORE_FILES = typer.Option(None, help="Ignore files to use when creat
89
98
 
90
99
  _BUILD_DETAILS = typer.Option(None, help="Build details of the image. To be passed in stringified json format.")
91
100
 
92
- _SOURCE = typer.Option(None, help="The source via which the image is to be created.")
101
+ _SOURCE = typer.Option(
102
+ None,
103
+ help="The source via which the image is to be created. Allowed values are 'github', 'dockerfile' and 'upload'.",
104
+ )
93
105
 
94
106
  _DOCKERFILE = typer.Option(None, help="The dockerfile to be used to create the image.")
95
107
 
@@ -167,7 +179,7 @@ def create(
167
179
  body (map):
168
180
  name (str): Name of the image.
169
181
  version (str | required: false): A valid semantic image version. If not provided, the version will be set to 0.0.1.
170
- type (str): Type of the image.
182
+ type (str): Type of the image. Allowed values are 'workflow', 'workspace-r', 'workspace-python, 'api' and 'webapp'.
171
183
  description (str | required: false): Description of the image.
172
184
  buildDetails (map | required: false):
173
185
  source (str | required: false): The source via which the image is to be created. Allowed values are 'github', 'dockerfile' and 'upload'. It is 'upload' by default.
@@ -429,7 +441,7 @@ def create_or_update(
429
441
  body (map):
430
442
  name (str): Name of the image.
431
443
  version (str | required: false): A valid semantic image version. If not provided, the next patch version of the latest version will be used.
432
- type (str): Type of the image.
444
+ type (str): Type of the image. Allowed values are 'workflow', 'workspace-r', 'workspace-python, 'api' and 'webapp'.
433
445
  description (str | required: false): Description of the image.
434
446
  buildDetails (map | required: false): If not provided and if the image version already exists, the build details of the existing version will be used.
435
447
  source (str | required: false): The source via which the image is to be created. Allowed values are 'github', 'dockerfile' and 'upload'. It is 'upload' by default if new version is being created otherwise the existing version's source will be used.
@@ -32,7 +32,10 @@ app = typer.Typer(
32
32
  short_help="Create and manage Tenant Settings.",
33
33
  )
34
34
 
35
- _ENTITY_TYPE = typer.Option(..., help="Entity type to be used in this operation (e.g. - feed, workflow).")
35
+ _ENTITY_TYPE = typer.Option(
36
+ ...,
37
+ help="Entity type to be used in this operation (e.g. - `workflow`, `webapp`, `api-deployment`).",
38
+ )
36
39
 
37
40
 
38
41
  @app.command(
@@ -119,12 +119,12 @@ def create(
119
119
  watchers (list(map) | required: false):
120
120
  - events (map):
121
121
  success (boolean | required: false): Whether to call event on success.
122
- fail (boolean | required: false): Whether to call event on success.
122
+ fail (boolean | required: false): Whether to call event on failure.
123
123
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
124
124
  user (string): User to be notified.
125
125
  - events (map):
126
126
  success (boolean | required: false): Whether to call event on success.
127
- fail (boolean | required: false): Whether to call event on success.
127
+ fail (boolean | required: false): Whether to call event on failure.
128
128
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
129
129
  webhook (map):
130
130
  name (string): Name of the webhook.
@@ -132,7 +132,7 @@ def create(
132
132
  payload (string): Webhook payload.
133
133
  - events (map):
134
134
  success (boolean | required: false): Whether to call event on success.
135
- fail (boolean | required: false): Whether to call event on success.
135
+ fail (boolean | required: false): Whether to call event on failure.
136
136
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
137
137
  email (map):
138
138
  name (string): Name of the email watcher.
@@ -243,12 +243,12 @@ def update(
243
243
  watchers (list(map) | required: false):
244
244
  - events (map):
245
245
  success (boolean | required: false): Whether to call event on success.
246
- fail (boolean | required: false): Whether to call event on success.
246
+ fail (boolean | required: false): Whether to call event on failure.
247
247
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
248
248
  user (string): User to be notified.
249
249
  - events (map):
250
250
  success (boolean | required: false): Whether to call event on success.
251
- fail (boolean | required: false): Whether to call event on success.
251
+ fail (boolean | required: false): Whether to call event on failure.
252
252
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
253
253
  webhook (map):
254
254
  name (string): Name of the webhook.
@@ -256,7 +256,7 @@ def update(
256
256
  payload (string): Webhook payload.
257
257
  - events (map):
258
258
  success (boolean | required: false): Whether to call event on success.
259
- fail (boolean | required: false): Whether to call event on success.
259
+ fail (boolean | required: false): Whether to call event on failure.
260
260
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
261
261
  email (map):
262
262
  name (string): Name of the email watcher.
@@ -367,12 +367,12 @@ def create_or_update(
367
367
  watchers (list(map) | required: false):
368
368
  - events (map):
369
369
  success (boolean | required: false): Whether to call event on success.
370
- fail (boolean | required: false): Whether to call event on success.
370
+ fail (boolean | required: false): Whether to call event on failure.
371
371
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
372
372
  user (string): User to be notified.
373
373
  - events (map):
374
374
  success (boolean | required: false): Whether to call event on success.
375
- fail (boolean | required: false): Whether to call event on success.
375
+ fail (boolean | required: false): Whether to call event on failure.
376
376
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
377
377
  webhook (map):
378
378
  name (string): Name of the webhook.
@@ -380,7 +380,7 @@ def create_or_update(
380
380
  payload (string): Webhook payload.
381
381
  - events (map):
382
382
  success (boolean | required: false): Whether to call event on success.
383
- fail (boolean | required: false): Whether to call event on success.
383
+ fail (boolean | required: false): Whether to call event on failure.
384
384
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
385
385
  email (map):
386
386
  name (string): Name of the email watcher.
@@ -521,12 +521,12 @@ def patch(
521
521
  watchers (list(map) | required: false):
522
522
  - events (map):
523
523
  success (boolean | required: false): Whether to call event on success.
524
- fail (boolean | required: false): Whether to call event on success.
524
+ fail (boolean | required: false): Whether to call event on failure.
525
525
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
526
526
  user (string): User to be notified.
527
527
  - events (map):
528
528
  success (boolean | required: false): Whether to call event on success.
529
- fail (boolean | required: false): Whether to call event on success.
529
+ fail (boolean | required: false): Whether to call event on failure.
530
530
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
531
531
  webhook (map):
532
532
  name (string): Name of the webhook.
@@ -534,7 +534,7 @@ def patch(
534
534
  payload (string): Webhook payload.
535
535
  - events (map):
536
536
  success (boolean | required: false): Whether to call event on success.
537
- fail (boolean | required: false): Whether to call event on success.
537
+ fail (boolean | required: false): Whether to call event on failure.
538
538
  runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
539
539
  email (map):
540
540
  name (string): Name of the email watcher.
peak/press/apps.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
  """Apps client module."""
22
+
22
23
  from __future__ import annotations
23
24
 
24
25
  import json
@@ -151,7 +152,8 @@ class App(BaseClient):
151
152
 
152
153
  All App Specs must have unique names within a tenant.
153
154
  An App Spec must now be made up of already existing block specs.
154
- Spec details (specId and release) needs to be added in the spec body inside `config` key.
155
+ Spec details (Block spec ID and Release version) needs to be added to the `config` key.
156
+ `config` also contains a `autoRunOnDeploy` key which is a boolean value to specify if the resource should be executed on successful deployment of the app. By default, it is False.
155
157
 
156
158
  REFERENCE:
157
159
  🔗 `API Documentation <https://press.peak.ai/api-docs/index.htm#/App%20Specs/post_v1_apps_specs_>`__
@@ -196,7 +198,8 @@ class App(BaseClient):
196
198
  "id": "string(required)",
197
199
  "release": {
198
200
  "version": "string(required)",
199
- }
201
+ },
202
+ "autoRunOnDeploy": "boolean (By default it is False)",
200
203
  }
201
204
  ]
202
205
  }
@@ -319,6 +322,9 @@ class App(BaseClient):
319
322
  def create_spec_release(self, spec_id: str, body: Dict[str, Any]) -> Dict[str, str]:
320
323
  """Publish a new release to an existing App spec.
321
324
 
325
+ Spec details (Block spec ID and Release version) needs to be added to the `config` key.
326
+ `config` also contains a `autoRunOnDeploy` key which is a boolean value to specify if the resource should be executed on successful deployment of the app. By default, it is False.
327
+
322
328
  REFERENCE:
323
329
  🔗 `API Documentation <https://press.peak.ai/api-docs/index.htm#/App%20Specs/post_v1_apps_specs__specId__releases>`__
324
330
 
@@ -338,7 +344,8 @@ class App(BaseClient):
338
344
  "id": "string(required)",
339
345
  "release": {
340
346
  "version": "string(required)",
341
- }
347
+ },
348
+ "autoRunOnDeploy": "boolean (By default it is False)",
342
349
  }
343
350
  ],
344
351
  "release": {