peak-sdk 1.3.0__tar.gz → 1.5.0__tar.gz

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 (108) hide show
  1. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/LICENSE +1 -1
  2. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/PKG-INFO +6 -6
  3. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/__init__.py +1 -1
  4. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/_metadata.py +43 -0
  5. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/_version.py +1 -1
  6. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/cli.py +3 -1
  7. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/helpers.py +27 -0
  8. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/press/blocks/specs.py +0 -2
  9. peak_sdk-1.5.0/peak/cli/resources/services.py +632 -0
  10. peak_sdk-1.5.0/peak/cli/resources/users.py +71 -0
  11. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/resources/webapps.py +75 -14
  12. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/resources/workflows.py +0 -4
  13. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/helpers.py +27 -0
  14. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/output.py +9 -0
  15. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/press/blocks.py +10 -15
  16. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/resources/__init__.py +2 -2
  17. peak_sdk-1.5.0/peak/resources/services.py +413 -0
  18. peak_sdk-1.5.0/peak/resources/users.py +93 -0
  19. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/resources/webapps.py +13 -7
  20. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/resources/workflows.py +3 -7
  21. peak_sdk-1.5.0/peak/sample_yaml/resources/services/create_or_update_service.yaml +24 -0
  22. peak_sdk-1.5.0/peak/sample_yaml/resources/services/create_service.yaml +24 -0
  23. peak_sdk-1.5.0/peak/sample_yaml/resources/services/test_service.yaml +8 -0
  24. peak_sdk-1.5.0/peak/sample_yaml/resources/services/update_service.yaml +22 -0
  25. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/create_or_update_workflow.yaml +0 -1
  26. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/update_workflow.yaml +0 -1
  27. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/session.py +7 -4
  28. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/template.py +2 -2
  29. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/validators.py +34 -2
  30. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/pypi-home.md +5 -5
  31. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/pyproject.toml +3 -1
  32. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/auth.py +0 -0
  33. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/base_client.py +0 -0
  34. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/callbacks.py +0 -0
  35. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/__init_.py +0 -0
  36. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/args.py +0 -0
  37. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/press/__init__.py +0 -0
  38. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/press/apps/__init__.py +0 -0
  39. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/press/apps/deployments.py +0 -0
  40. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/press/apps/specs.py +0 -0
  41. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/press/blocks/__init__.py +0 -0
  42. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/press/blocks/deployments.py +0 -0
  43. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/press/deployments.py +0 -0
  44. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/press/specs.py +0 -0
  45. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/resources/__init__.py +0 -0
  46. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/resources/artifacts.py +0 -0
  47. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/resources/images.py +0 -0
  48. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/resources/tenants.py +0 -0
  49. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/ruff.toml +0 -0
  50. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/cli/version.py +0 -0
  51. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/compression.py +0 -0
  52. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/config.py +0 -0
  53. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/constants.py +0 -0
  54. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/exceptions.py +0 -0
  55. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/handler.py +0 -0
  56. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/logger.py +0 -0
  57. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/press/__init__.py +0 -0
  58. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/press/apps.py +0 -0
  59. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/press/deployments.py +0 -0
  60. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/press/specs.py +0 -0
  61. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/py.typed +0 -0
  62. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/resources/artifacts.py +0 -0
  63. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/resources/images.py +0 -0
  64. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/resources/tenants.py +0 -0
  65. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/apps/deployments/create_app_deployment.yaml +0 -0
  66. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/apps/deployments/create_app_deployment_revision.yaml +0 -0
  67. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/apps/deployments/update_app_deployment_metadata.yaml +0 -0
  68. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/apps/specs/create_app_spec.yaml +0 -0
  69. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml +0 -0
  70. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/apps/specs/update_app_spec_metadata.yaml +0 -0
  71. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/blocks/deployments/create_block_deployment.yaml +0 -0
  72. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/blocks/deployments/create_block_deployment_revision.yaml +0 -0
  73. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/blocks/deployments/patch_block_parameters.yaml +0 -0
  74. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/blocks/deployments/update_block_deployment_metadata.yaml +0 -0
  75. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/blocks/specs/create_block_spec.yaml +0 -0
  76. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/blocks/specs/create_block_spec_release.yaml +0 -0
  77. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/press/blocks/specs/update_block_spec_metadata.yaml +0 -0
  78. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/artifacts/create_artifact.yaml +0 -0
  79. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/artifacts/create_artifact_version.yaml +0 -0
  80. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/artifacts/update_artifact_metadata.yaml +0 -0
  81. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/images/dockerfile/create_image.yaml +0 -0
  82. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/images/dockerfile/create_image_version.yaml +0 -0
  83. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/images/dockerfile/update_version.yaml +0 -0
  84. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/images/github/create_image.yaml +0 -0
  85. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/images/github/create_image_version.yaml +0 -0
  86. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/images/github/update_version.yaml +0 -0
  87. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/images/upload/create_image.yaml +0 -0
  88. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/images/upload/create_image_version.yaml +0 -0
  89. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/images/upload/create_or_update_image.yaml +0 -0
  90. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/images/upload/update_version.yaml +0 -0
  91. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/webapps/create_or_update_webapp.yaml +0 -0
  92. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/webapps/create_webapp.yaml +0 -0
  93. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/webapps/update_webapp.yaml +0 -0
  94. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/create_workflow.yaml +0 -0
  95. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/execute_partial_workflow.yaml +0 -0
  96. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/execute_workflow.yaml +0 -0
  97. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/patch_workflow.yaml +0 -0
  98. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/workflow_auto_retry.yaml +0 -0
  99. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/workflow_execution_parameters.yaml +0 -0
  100. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/workflow_input_parameters.yaml +0 -0
  101. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/workflow_output_parameters.yaml +0 -0
  102. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/sample_yaml/resources/workflows/workflow_skippable_steps.yaml +0 -0
  103. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/telemetry.py +0 -0
  104. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/tools/__init__.py +0 -0
  105. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/tools/logging/__init__.py +0 -0
  106. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/tools/logging/log_handler.py +0 -0
  107. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/tools/logging/log_level.py +0 -0
  108. {peak_sdk-1.3.0 → peak_sdk-1.5.0}/peak/tools/logging/utils.py +0 -0
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright © 2023 Peak-AI
189
+ Copyright © 2024 Peak-AI
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: peak-sdk
3
- Version: 1.3.0
3
+ Version: 1.5.0
4
4
  Summary: Python SDK for interacting with the Peak platform
5
5
  Home-page: https://docs.peak.ai/sdk
6
6
  License: Apache-2.0
@@ -94,13 +94,13 @@ Follow these steps to create a virtual environment using Python's built-in `venv
94
94
  echo "compinit" >> ~/.zshrc # replace .zshrc with your shell's configuration file
95
95
  ```
96
96
 
97
- ### Using the SDK/CLI
97
+ ### Using the SDK and CLI
98
98
 
99
- - To start using the SDK and CLI, you'll need either an API Key or an Access Token.
100
- - If you don't have one yet, sign up for an account on the Peak platform to obtain your API key or Access token.
101
- - To export it, run the following command in your terminal and replace <api_key> with your actual API key:
99
+ - To start using the SDK and CLI, you'll need either an API Key or a Personal Access Token (PAT).
100
+ - If you don't have one yet, sign up for an account on the Peak platform to obtain your API key or Personal Access token (PAT).
101
+ - To export it, run the following command in your terminal and replace <peak_auth_token> with your actual API key or PAT:
102
102
  ```
103
- export API_KEY=<api_key | access_token>
103
+ export PEAK_AUTH_TOKEN=<peak_auth_token>
104
104
  ```
105
105
 
106
106
  ### Documentation
@@ -20,7 +20,7 @@
20
20
  #
21
21
  """This file is part of the peak-sdk framework.
22
22
 
23
- Copyright © 2023 Peak AI
23
+ Copyright © 2024 Peak AI
24
24
 
25
25
  Unauthorized copying of this file, via any medium is strictly prohibited.
26
26
  """
@@ -241,6 +241,37 @@ command_metadata: Dict[str, Any] = {
241
241
  "subheader_key": "webappsCount",
242
242
  },
243
243
  },
244
+ "list_services": {
245
+ "table_params": {
246
+ "output_keys": {
247
+ "id": {
248
+ "label": "ID",
249
+ },
250
+ "name": {
251
+ "label": "Name",
252
+ },
253
+ "serviceType": {
254
+ "label": "Service Type",
255
+ },
256
+ "status": {
257
+ "label": "Status",
258
+ },
259
+ "updatedBy": {
260
+ "label": "Updated By",
261
+ },
262
+ "updatedAt": {
263
+ "label": "Updated At (UTC)",
264
+ },
265
+ "tags": {
266
+ "label": "Tags",
267
+ "parser": tag_parser,
268
+ },
269
+ },
270
+ "title": "Services",
271
+ "data_key": "services",
272
+ "subheader_key": "servicesCount",
273
+ },
274
+ },
244
275
  "list_artifacts": {
245
276
  "table_params": {
246
277
  "output_keys": {
@@ -637,6 +668,18 @@ command_metadata: Dict[str, Any] = {
637
668
  "create_or_update_webapp": {
638
669
  "request_body_yaml_path": "sample_yaml/resources/webapps/create_or_update_webapp.yaml",
639
670
  },
671
+ "create_service": {
672
+ "request_body_yaml_path": "sample_yaml/resources/services/create_service.yaml",
673
+ },
674
+ "update_service": {
675
+ "request_body_yaml_path": "sample_yaml/resources/services/update_service.yaml",
676
+ },
677
+ "create_or_update_service": {
678
+ "request_body_yaml_path": "sample_yaml/resources/services/create_or_update_service.yaml",
679
+ },
680
+ "test_service": {
681
+ "request_body_yaml_path": "sample_yaml/resources/services/test_service.yaml",
682
+ },
640
683
  "create_app_spec": {
641
684
  "request_body_yaml_path": "sample_yaml/press/apps/specs/create_app_spec.yaml",
642
685
  },
@@ -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.3.0"
21
+ __version__: str = "1.5.0"
@@ -25,7 +25,7 @@ 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, tenants, webapps, workflows
28
+ from peak.cli.resources import artifacts, images, services, tenants, users, webapps, workflows
29
29
  from peak.constants import Sources
30
30
  from peak.output import Writer
31
31
 
@@ -37,11 +37,13 @@ typer_app.add_typer(images.app, name="images")
37
37
  typer_app.add_typer(artifacts.app, name="artifacts")
38
38
  typer_app.add_typer(workflows.app, name="workflows")
39
39
  typer_app.add_typer(webapps.app, name="webapps")
40
+ typer_app.add_typer(services.app, name="services")
40
41
  typer_app.add_typer(tenants.app, name="tenants")
41
42
  typer_app.add_typer(apps.app, name="apps")
42
43
  typer_app.add_typer(blocks.app, name="blocks")
43
44
  typer_app.add_typer(specs.app, name="specs")
44
45
  typer_app.add_typer(deployments.app, name="deployments")
46
+ typer_app.add_typer(users.app, name="users")
45
47
 
46
48
 
47
49
  @typer_app.callback()
@@ -189,6 +189,31 @@ def parse_build_arguments(build_arguments: List[str]) -> List[Dict[str, str]]:
189
189
  return parsed_build_arguments
190
190
 
191
191
 
192
+ def parse_envs(env: List[str]) -> Dict[str, str]:
193
+ """Parses envs provided via cli args to the format {arg1: value1}.
194
+
195
+ Args:
196
+ env (List[str]): List of envs provided via cli args.
197
+
198
+ Returns:
199
+ Dict[str, str]: Envs in the required format.
200
+
201
+ Raises:
202
+ BadParameterException: If a value is invalid.
203
+ """
204
+ parsed_envs: Dict[str, str] = {}
205
+ for env_arg in env:
206
+ try:
207
+ key, value = env_arg.split("=", 1)
208
+ except ValueError as err:
209
+ raise BadParameterException(
210
+ env_arg,
211
+ message="Invalid env format. It should in the --env arg1=value1 format",
212
+ ) from err
213
+ parsed_envs[key] = value
214
+ return parsed_envs
215
+
216
+
192
217
  def format_logs(logs: List[Dict[str, Any]]) -> str:
193
218
  """Formats logs into a readable format.
194
219
 
@@ -223,7 +248,9 @@ def get_client(command: str) -> base_client.BaseClient:
223
248
  "artifacts": resources.artifacts,
224
249
  "images": resources.images,
225
250
  "workflows": resources.workflows,
251
+ "services": resources.services,
226
252
  "webapps": resources.webapps,
227
253
  "tenants": resources.tenants,
254
+ "users": resources.users,
228
255
  }
229
256
  return command_client_map[command].get_client() # type: ignore[no-any-return]
@@ -165,7 +165,6 @@ def create(
165
165
  - cron (string | required: false): A valid cron expression.
166
166
  webhook (boolean | required: false): Should be true if webhook type trigger is to be used.
167
167
  webhookId (string | required: false): ID of the webhook.
168
- webhookPolicy (string | required: false): Policy of the webhook to be used. Should be one of "generate" or "preserve". It is "generate" by default.
169
168
  watchers (list(map) | required: false):
170
169
  - events (map):
171
170
  success (boolean | required: false): Whether to call event on success.
@@ -430,7 +429,6 @@ def create_release(
430
429
  cron (string | required: false): A valid cron expression.
431
430
  webhook (boolean | required: false): Should be true if webhook type trigger is to be used.
432
431
  webhookId (string | required: false): ID of the webhook.
433
- webhookPolicy (string | required: false): Policy of the webhook to be used. Should be one of "generate" or "preserve". It is "generate" by default.
434
432
  watchers (list(map) | required: false):
435
433
  - events (map):
436
434
  success (boolean | required: false): Whether to call event on success.