peak-sdk 1.8.0__py3-none-any.whl → 1.10.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 (35) hide show
  1. peak/_version.py +1 -1
  2. peak/cli/press/blocks/specs.py +252 -7
  3. peak/cli/resources/tenants.py +53 -3
  4. peak/cli/resources/workflows.py +320 -18
  5. peak/press/blocks.py +305 -1
  6. peak/resources/tenants.py +37 -2
  7. peak/resources/workflows.py +476 -8
  8. peak/sample_yaml/press/blocks/specs/workflow/create_block_spec.yaml +49 -1
  9. peak/sample_yaml/press/blocks/specs/workflow/create_block_spec_release.yaml +49 -1
  10. peak/sample_yaml/resources/images/dockerfile/create_image.yaml +2 -2
  11. peak/sample_yaml/resources/images/dockerfile/create_image_version.yaml +1 -1
  12. peak/sample_yaml/resources/images/dockerfile/update_version.yaml +1 -1
  13. peak/sample_yaml/resources/images/github/create_image.yaml +1 -1
  14. peak/sample_yaml/resources/images/github/create_image_version.yaml +1 -1
  15. peak/sample_yaml/resources/images/github/update_version.yaml +1 -1
  16. peak/sample_yaml/resources/images/upload/create_image.yaml +3 -3
  17. peak/sample_yaml/resources/images/upload/create_image_version.yaml +4 -4
  18. peak/sample_yaml/resources/images/upload/create_or_update_image.yaml +4 -4
  19. peak/sample_yaml/resources/images/upload/update_version.yaml +4 -4
  20. peak/sample_yaml/resources/services/test_service.yaml +1 -1
  21. peak/sample_yaml/resources/workflows/create_or_update_workflow.yaml +36 -3
  22. peak/sample_yaml/resources/workflows/create_workflow.yaml +33 -4
  23. peak/sample_yaml/resources/workflows/patch_workflow.yaml +16 -4
  24. peak/sample_yaml/resources/workflows/update_workflow.yaml +35 -2
  25. peak/sample_yaml/resources/workflows/workflow_auto_retry.yaml +59 -12
  26. peak/sample_yaml/resources/workflows/workflow_execution_parameters.yaml +75 -10
  27. peak/sample_yaml/resources/workflows/workflow_input_parameters.yaml +42 -2
  28. peak/sample_yaml/resources/workflows/workflow_input_parameters_inherit.yaml +64 -0
  29. peak/sample_yaml/resources/workflows/workflow_output_parameters.yaml +20 -3
  30. peak/sample_yaml/resources/workflows/workflow_skippable_steps.yaml +45 -12
  31. {peak_sdk-1.8.0.dist-info → peak_sdk-1.10.0.dist-info}/METADATA +1 -1
  32. {peak_sdk-1.8.0.dist-info → peak_sdk-1.10.0.dist-info}/RECORD +35 -34
  33. {peak_sdk-1.8.0.dist-info → peak_sdk-1.10.0.dist-info}/LICENSE +0 -0
  34. {peak_sdk-1.8.0.dist-info → peak_sdk-1.10.0.dist-info}/WHEEL +0 -0
  35. {peak_sdk-1.8.0.dist-info → peak_sdk-1.10.0.dist-info}/entry_points.txt +0 -0
peak/press/blocks.py CHANGED
@@ -225,7 +225,7 @@ class Block(BaseClient):
225
225
  },
226
226
  "steps": {
227
227
  "stepName": {
228
- "type": "string",
228
+ "type": "standard",
229
229
  "image": {
230
230
  "version": "string",
231
231
  "dockerfile": "string",
@@ -292,6 +292,158 @@ class Block(BaseClient):
292
292
  }
293
293
  ]
294
294
  }
295
+ },
296
+ "stepName2": {
297
+ "type": "http",
298
+ "method": "enum(get, post, put, patch, delete)",
299
+ "url": "string",
300
+ "payload": "string",
301
+ "headers": {
302
+ "absolute": {
303
+ "key (string)": "value (string)"
304
+ },
305
+ "secrets": {
306
+ "key (string)": "value (string)"
307
+ }
308
+ },
309
+ "auth": {
310
+ "type": "enum(no-auth, oauth, basic, api-key, bearer-token)(required)",
311
+ "clientId": "string | required for oauth",
312
+ "clientSecret": "",
313
+ "authUrl": "string | required for oauth",
314
+ "username": "string | required for basic",
315
+ "password": "",
316
+ "apiKey": "",
317
+ "bearerToken": "string | required for bearer-token"
318
+ },
319
+ "parents": [],
320
+ "parameters": {
321
+ "env": {
322
+ "key (string)": "value (string)"
323
+ },
324
+ "inherit": {
325
+ "key (string)": "value (string)"
326
+ },
327
+ "secrets": [],
328
+ },
329
+ "outputParameters": {
330
+ "key (string)": "value (string)"
331
+ },
332
+ "executionParameters": {
333
+ "conditional": [
334
+ {
335
+ "condition": "string",
336
+ "paramName": "string",
337
+ "stepName": "string",
338
+ "value": "string"
339
+ }
340
+ ],
341
+ "parentStatus": [
342
+ {
343
+ "condition": "string",
344
+ "parents": [],
345
+ "status": []
346
+ }
347
+ ]
348
+ },
349
+ "runConfiguration": {
350
+ "retryOptions": {
351
+ "duration": "number",
352
+ "exitCodes": [],
353
+ "exponentialBackoff": "boolean",
354
+ "numberOfRetries": "number"
355
+ },
356
+ "skipConfiguration": {
357
+ "skip": "boolean",
358
+ "skipDAG": "boolean",
359
+ }
360
+ }
361
+ },
362
+ "stepName3": {
363
+ "type": "export",
364
+ "schema": "string (required)",
365
+ "table": "string (required)",
366
+ "sortBy": "string (required)",
367
+ "sortOrder": "enum(asc, desc) | Default is asc",
368
+ "compression": "boolean | Default is false",
369
+ "parents": [],
370
+ "executionParameters": {
371
+ "conditional": [
372
+ {
373
+ "condition": "string",
374
+ "paramName": "string",
375
+ "stepName": "string",
376
+ "value": "string"
377
+ }
378
+ ],
379
+ "parentStatus": [
380
+ {
381
+ "condition": "string",
382
+ "parents": [],
383
+ "status": []
384
+ }
385
+ ]
386
+ },
387
+ "runConfiguration": {
388
+ "retryOptions": {
389
+ "duration": "number",
390
+ "exitCodes": [],
391
+ "exponentialBackoff": "boolean",
392
+ "numberOfRetries": "number"
393
+ },
394
+ "skipConfiguration": {
395
+ "skip": "boolean",
396
+ "skipDAG": "boolean",
397
+ }
398
+ }
399
+ },
400
+ "stepName4": {
401
+ "type": "sql",
402
+ "sqlQueryPath": "string",
403
+ "repository": {
404
+ "branch": "string | Required if repository is provided",
405
+ "token": "string",
406
+ "url": "string | Required if repository is provided",
407
+ "filePath": "string | Required if repository is provided"
408
+ }
409
+ "parents": [],
410
+ "parameters": {
411
+ "env": {
412
+ "key (string)": "value (string)"
413
+ },
414
+ "inherit": {
415
+ "key (string)": "value (string)"
416
+ }
417
+ },
418
+ "executionParameters": {
419
+ "conditional": [
420
+ {
421
+ "condition": "string",
422
+ "paramName": "string",
423
+ "stepName": "string",
424
+ "value": "string"
425
+ }
426
+ ],
427
+ "parentStatus": [
428
+ {
429
+ "condition": "string",
430
+ "parents": [],
431
+ "status": []
432
+ }
433
+ ]
434
+ },
435
+ "runConfiguration": {
436
+ "retryOptions": {
437
+ "duration": "number",
438
+ "exitCodes": [],
439
+ "exponentialBackoff": "boolean",
440
+ "numberOfRetries": "number"
441
+ },
442
+ "skipConfiguration": {
443
+ "skip": "boolean",
444
+ "skipDAG": "boolean",
445
+ }
446
+ }
295
447
  }
296
448
  },
297
449
  "triggers": [
@@ -703,6 +855,158 @@ class Block(BaseClient):
703
855
  }
704
856
  ]
705
857
  }
858
+ },
859
+ "stepName2": {
860
+ "type": "http",
861
+ "method": "enum(get, post, put, patch, delete)",
862
+ "url": "string",
863
+ "payload": "string",
864
+ "headers": {
865
+ "absolute": {
866
+ "key (string)": "value (string)"
867
+ },
868
+ "secrets": {
869
+ "key (string)": "value (string)"
870
+ }
871
+ },
872
+ "auth": {
873
+ "type": "enum(no-auth, oauth, basic, api-key, bearer-token)(required)",
874
+ "clientId": "string | required for oauth",
875
+ "clientSecret": "",
876
+ "authUrl": "string | required for oauth",
877
+ "username": "string | required for basic",
878
+ "password": "",
879
+ "apiKey": "",
880
+ "bearerToken": "string | required for bearer-token"
881
+ },
882
+ "parents": [],
883
+ "parameters": {
884
+ "env": {
885
+ "key (string)": "value (string)"
886
+ },
887
+ "inherit": {
888
+ "key (string)": "value (string)"
889
+ },
890
+ "secrets": [],
891
+ },
892
+ "outputParameters": {
893
+ "key (string)": "value (string)"
894
+ },
895
+ "executionParameters": {
896
+ "conditional": [
897
+ {
898
+ "condition": "string",
899
+ "paramName": "string",
900
+ "stepName": "string",
901
+ "value": "string"
902
+ }
903
+ ],
904
+ "parentStatus": [
905
+ {
906
+ "condition": "string",
907
+ "parents": [],
908
+ "status": []
909
+ }
910
+ ]
911
+ },
912
+ "runConfiguration": {
913
+ "retryOptions": {
914
+ "duration": "number",
915
+ "exitCodes": [],
916
+ "exponentialBackoff": "boolean",
917
+ "numberOfRetries": "number"
918
+ },
919
+ "skipConfiguration": {
920
+ "skip": "boolean",
921
+ "skipDAG": "boolean",
922
+ }
923
+ }
924
+ },
925
+ "stepName3": {
926
+ "type": "export",
927
+ "schema": "string (required)",
928
+ "table": "string (required)",
929
+ "sortBy": "string (required)",
930
+ "sortOrder": "enum(asc, desc) | Default is asc",
931
+ "compression": "boolean | Default is false",
932
+ "parents": [],
933
+ "executionParameters": {
934
+ "conditional": [
935
+ {
936
+ "condition": "string",
937
+ "paramName": "string",
938
+ "stepName": "string",
939
+ "value": "string"
940
+ }
941
+ ],
942
+ "parentStatus": [
943
+ {
944
+ "condition": "string",
945
+ "parents": [],
946
+ "status": []
947
+ }
948
+ ]
949
+ },
950
+ "runConfiguration": {
951
+ "retryOptions": {
952
+ "duration": "number",
953
+ "exitCodes": [],
954
+ "exponentialBackoff": "boolean",
955
+ "numberOfRetries": "number"
956
+ },
957
+ "skipConfiguration": {
958
+ "skip": "boolean",
959
+ "skipDAG": "boolean",
960
+ }
961
+ }
962
+ },
963
+ "stepName4": {
964
+ "type": "sql",
965
+ "sqlQueryPath": "string",
966
+ "repository": {
967
+ "branch": "string | Required if repository is provided",
968
+ "token": "string",
969
+ "url": "string | Required if repository is provided",
970
+ "filePath": "string | Required if repository is provided"
971
+ }
972
+ "parents": [],
973
+ "parameters": {
974
+ "env": {
975
+ "key (string)": "value (string)"
976
+ },
977
+ "inherit": {
978
+ "key (string)": "value (string)"
979
+ }
980
+ },
981
+ "executionParameters": {
982
+ "conditional": [
983
+ {
984
+ "condition": "string",
985
+ "paramName": "string",
986
+ "stepName": "string",
987
+ "value": "string"
988
+ }
989
+ ],
990
+ "parentStatus": [
991
+ {
992
+ "condition": "string",
993
+ "parents": [],
994
+ "status": []
995
+ }
996
+ ]
997
+ },
998
+ "runConfiguration": {
999
+ "retryOptions": {
1000
+ "duration": "number",
1001
+ "exitCodes": [],
1002
+ "exponentialBackoff": "boolean",
1003
+ "numberOfRetries": "number"
1004
+ },
1005
+ "skipConfiguration": {
1006
+ "skip": "boolean",
1007
+ "skipDAG": "boolean",
1008
+ }
1009
+ }
706
1010
  }
707
1011
  },
708
1012
  "triggers": [
peak/resources/tenants.py CHANGED
@@ -31,7 +31,8 @@ from peak.session import Session
31
31
  class Tenant(BaseClient):
32
32
  """Tenant client class."""
33
33
 
34
- BASE_ENDPOINT = "quota/api/v1"
34
+ QUOTA_BASE_ENDPOINT = "quota/api/v1"
35
+ CONNECTIONS_BASE_ENDPOINT = "connections/api/v1"
35
36
 
36
37
  def list_instance_options(
37
38
  self,
@@ -56,7 +57,7 @@ class Tenant(BaseClient):
56
57
  NotFoundException: The given image does not exist.
57
58
  InternalServerErrorException: The server failed to process the request.
58
59
  """
59
- method, endpoint = HttpMethods.GET, f"{self.BASE_ENDPOINT}/settings/tenant-instance-options"
60
+ method, endpoint = HttpMethods.GET, f"{self.QUOTA_BASE_ENDPOINT}/settings/tenant-instance-options"
60
61
  params = {"entityType": entity_type}
61
62
 
62
63
  return self.session.create_request( # type: ignore[no-any-return]
@@ -66,6 +67,40 @@ class Tenant(BaseClient):
66
67
  params=params,
67
68
  )
68
69
 
70
+ def get_credentials(
71
+ self,
72
+ data_store_type: Optional[str] = None,
73
+ ) -> Dict[str, Any]:
74
+ """Retrieve credentials for a given data store type.
75
+
76
+ REFERENCE:
77
+ 🔗 `API Documentation <https://service.peak.ai/connections/api-docs/index.htm#/connections/get_api_v1_connections_credentials>`__
78
+
79
+ Args:
80
+ data_store_type (str): The type of the data store.
81
+ Allowed values are - data-warehouse.
82
+ Default - data-warehouse
83
+
84
+ Returns:
85
+ Dict[str, Any]: a dictionary containing the credentials for the data store.
86
+
87
+ Raises:
88
+ BadRequestException: The given request parameters are invalid.
89
+ UnauthorizedException: The credentials are invalid.
90
+ ForbiddenException: The user does not have permission to perform the operation.
91
+ NotFoundException: The given image does not exist.
92
+ InternalServerErrorException: The server failed to process the request.
93
+ """
94
+ method, endpoint = HttpMethods.GET, f"{self.CONNECTIONS_BASE_ENDPOINT}/connections/credentials"
95
+ params = {"type": data_store_type}
96
+
97
+ return self.session.create_request( # type: ignore[no-any-return]
98
+ endpoint,
99
+ method,
100
+ content_type=ContentType.APPLICATION_JSON,
101
+ params=params,
102
+ )
103
+
69
104
 
70
105
  def get_client(session: Optional[Session] = None) -> Tenant:
71
106
  """Returns a Tenant client, If no session is provided, a default session is used.