peak-sdk 1.6.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.
Files changed (57) hide show
  1. peak/_metadata.py +78 -58
  2. peak/_version.py +1 -1
  3. peak/callbacks.py +22 -2
  4. peak/cli/args.py +19 -0
  5. peak/cli/helpers.py +12 -8
  6. peak/cli/press/apps/deployments.py +72 -18
  7. peak/cli/press/apps/specs.py +29 -11
  8. peak/cli/press/blocks/deployments.py +71 -18
  9. peak/cli/press/blocks/specs.py +95 -35
  10. peak/cli/press/deployments.py +40 -1
  11. peak/cli/press/specs.py +2 -2
  12. peak/cli/resources/alerts/emails.py +4 -5
  13. peak/cli/resources/artifacts.py +9 -9
  14. peak/cli/resources/images.py +29 -18
  15. peak/cli/resources/services.py +6 -7
  16. peak/cli/resources/tenants.py +4 -2
  17. peak/cli/resources/users.py +3 -3
  18. peak/cli/resources/webapps.py +6 -6
  19. peak/cli/resources/workflows.py +24 -25
  20. peak/compression.py +28 -13
  21. peak/exceptions.py +15 -1
  22. peak/handler.py +5 -1
  23. peak/helpers.py +38 -0
  24. peak/output.py +13 -6
  25. peak/press/apps.py +43 -3
  26. peak/press/blocks.py +450 -138
  27. peak/press/deployments.py +25 -0
  28. peak/resources/images.py +309 -86
  29. peak/sample_yaml/press/apps/specs/create_app_spec.yaml +2 -0
  30. peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml +2 -0
  31. peak/sample_yaml/press/blocks/specs/service/api/create_block_spec.yaml +102 -0
  32. peak/sample_yaml/press/blocks/specs/service/api/create_block_spec_release.yaml +88 -0
  33. peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec.yaml +103 -0
  34. peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec_release.yaml +89 -0
  35. peak/sample_yaml/press/blocks/specs/{create_block_spec.yaml → workflow/create_block_spec.yaml} +20 -1
  36. peak/sample_yaml/press/blocks/specs/{create_block_spec_release.yaml → workflow/create_block_spec_release.yaml} +20 -1
  37. peak/sample_yaml/resources/images/dockerfile/create_image.yaml +3 -0
  38. peak/sample_yaml/resources/images/dockerfile/create_image_version.yaml +3 -0
  39. peak/sample_yaml/resources/images/dockerfile/update_version.yaml +3 -0
  40. peak/sample_yaml/resources/images/github/create_image.yaml +3 -0
  41. peak/sample_yaml/resources/images/github/create_image_version.yaml +3 -0
  42. peak/sample_yaml/resources/images/github/update_version.yaml +3 -0
  43. peak/sample_yaml/resources/images/upload/create_image.yaml +3 -0
  44. peak/sample_yaml/resources/images/upload/create_image_version.yaml +3 -0
  45. peak/sample_yaml/resources/images/upload/create_or_update_image.yaml +3 -0
  46. peak/sample_yaml/resources/images/upload/update_version.yaml +3 -0
  47. peak/sample_yaml/resources/workflows/create_or_update_workflow.yaml +9 -1
  48. peak/sample_yaml/resources/workflows/create_workflow.yaml +9 -1
  49. peak/sample_yaml/resources/workflows/patch_workflow.yaml +9 -1
  50. peak/sample_yaml/resources/workflows/update_workflow.yaml +9 -1
  51. peak/session.py +1 -1
  52. peak/template.py +21 -2
  53. {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/METADATA +18 -18
  54. {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/RECORD +57 -53
  55. {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/LICENSE +0 -0
  56. {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/WHEEL +0 -0
  57. {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/entry_points.txt +0 -0
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": {
@@ -702,6 +709,39 @@ class App(BaseClient):
702
709
  subdomain="press",
703
710
  )
704
711
 
712
+ def redeploy(self, deployment_id: str) -> Dict[str, Any]:
713
+ """Redeploy latest revision of an existing App deployment.
714
+
715
+ This function allows you to redeploy an App deployment that is in a `failed` or `warning` state, provided at least one of its block deployments is also in a `failed` or `warning` state.
716
+
717
+ REFERENCE:
718
+ 🔗 `API Documentation <https://press.peak.ai/api-docs/index.htm#/App%20Deployments/post_v1_apps_deployments__deploymentId__redeploy>`__
719
+
720
+ Args:
721
+ deployment_id (str): The ID of the App deployment to redeploy.
722
+
723
+ Returns:
724
+ Dict[str, Any]: A dictionary containing details of the deployment.
725
+
726
+ Raises:
727
+ BadRequestException: The given parameters are invalid.
728
+ UnauthorizedException: The credentials are invalid.
729
+ ForbiddenException: The user does not have permission to perform the operation.
730
+ NotFoundException: The given App deployment or its revisions do not exist.
731
+ ConflictException: There is a conflict with the current state of the target resource.
732
+ UnprocessableEntityException: The server was unable to process the request.
733
+ InternalServerErrorException: the server encountered an unexpected condition that
734
+ prevented it from fulfilling the request.
735
+ """
736
+ method, endpoint = HttpMethods.POST, f"{self.DEPLOYMENTS_BASE_ENDPOINT}/{deployment_id}/redeploy"
737
+
738
+ return self.session.create_request( # type: ignore[no-any-return]
739
+ endpoint,
740
+ method,
741
+ content_type=ContentType.APPLICATION_JSON,
742
+ subdomain="press",
743
+ )
744
+
705
745
  def delete_deployment(self, deployment_id: str) -> Dict[None, None]:
706
746
  """Deletes an App deployment.
707
747