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/resources/images.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
  """image client module."""
22
+
22
23
  from __future__ import annotations
23
24
 
24
25
  from typing import Any, Dict, Iterator, List, Literal, Optional, Tuple, overload
@@ -94,7 +95,7 @@ class Image(BaseClient):
94
95
  name: (str | None): Image Name or version to search for.
95
96
  status (List[str] | None): Filter images on the basis of the status of the latest version.
96
97
  Valid values are `not-ready`, `ready`, `in-use`, `deleting`, `delete-failed`.
97
- scope (List[str] | None): Filter out on the basis of the type of the image - global or custom.
98
+ scope (List[str] | None): Filter out on the basis of the type of the image - `global` or `custom`.
98
99
  last_build_status (List[str] | None): Filter out on the basis of last build status of the latest version.
99
100
  Valid values are `building`, `failed`, `success`, `stopped`, `stopping`.
100
101
  tags (List[str] | None): Filter out on the basis of the tags attached to the latest version.
@@ -246,36 +247,92 @@ class Image(BaseClient):
246
247
  body (Dict[str, Any]): Represents the body to be used to create image. Schema can be found below.
247
248
  artifact (Optional[ArtifactInfo]): Mapping of artifact attributes that specifies how the artifact will be generated,
248
249
  it accepts two keys `path`, which is required and `ignore_files` which is optional, and defaults to `.dockerignore`, it is strongly advised that users use `ignore_files` when generating artifacts to avoid copying any extra files in artifact.
250
+ Required for image of source `upload`.
249
251
 
250
252
  Returns:
251
253
  Dict[str, Any]: `buildId`, `imageId`, and `versionId` of the newly created image and the corresponding version.
252
254
 
253
255
  SCHEMA:
254
- .. code-block:: json
255
-
256
- {
257
- "name": "string(required)",
258
- "type": "string(required)",
259
- "description": "string",
260
- "version": "string",
261
- "buildDetails":
256
+ Images can be created by three ways:
257
+
258
+ .. tabs::
259
+
260
+ .. tab:: Upload
261
+
262
+ .. code-block:: json
263
+
262
264
  {
263
- "source": "string",
264
- "buildArguments": [
265
+ "name": "string (required)",
266
+ "type": "string (required)",
267
+ "description": "string",
268
+ "version": "string",
269
+ "buildDetails":
265
270
  {
266
- "name": "string",
267
- "value": "string"
268
- }
269
- ],
270
- "useCache": "boolean",
271
- "dockerfile": "string",
272
- "branch": "string",
273
- "repository": "string",
274
- "token": "string",
275
- "dockerfilePath": "string",
276
- "context": "string"
277
- },
278
- }
271
+ "source": "string",
272
+ "buildArguments": [
273
+ {
274
+ "name": "string",
275
+ "value": "string"
276
+ }
277
+ ],
278
+ "secrets": [],
279
+ "useCache": "boolean",
280
+ "dockerfilePath": "string",
281
+ "context": "string"
282
+ },
283
+ }
284
+
285
+ .. tab:: Github
286
+
287
+ .. code-block:: json
288
+
289
+ {
290
+ "name": "string (required)",
291
+ "type": "string (required)",
292
+ "description": "string",
293
+ "version": "string",
294
+ "buildDetails":
295
+ {
296
+ "source": "string",
297
+ "buildArguments": [
298
+ {
299
+ "name": "string",
300
+ "value": "string"
301
+ }
302
+ ],
303
+ "secrets": [],
304
+ "useCache": "boolean",
305
+ "branch": "string",
306
+ "repository": "string",
307
+ "token": "string",
308
+ "dockerfilePath": "string",
309
+ "context": "string"
310
+ },
311
+ }
312
+
313
+ .. tab:: Dockerfile
314
+
315
+ .. code-block:: json
316
+
317
+ {
318
+ "name": "string (required)",
319
+ "type": "string (required)",
320
+ "description": "string",
321
+ "version": "string",
322
+ "buildDetails":
323
+ {
324
+ "source": "string",
325
+ "buildArguments": [
326
+ {
327
+ "name": "string",
328
+ "value": "string"
329
+ }
330
+ ],
331
+ "secrets": [],
332
+ "useCache": "boolean",
333
+ "dockerfile": "string"
334
+ },
335
+ }
279
336
 
280
337
  Raises:
281
338
  BadRequestException: The given request parameters are invalid.
@@ -319,29 +376,86 @@ class Image(BaseClient):
319
376
  Dict[str, Any]: `imageId`, `buildId`, `versionId` and `autodeploymentId` of the newly created version.
320
377
 
321
378
  SCHEMA:
322
- .. code-block:: json
379
+ Image versions can be created by three ways:
380
+
381
+ .. tabs::
382
+
383
+ .. tab:: Upload
384
+
385
+ .. code-block:: json
323
386
 
324
- {
325
- "description": "string",
326
- "version": "string",
327
- "buildDetails":
328
387
  {
329
- "source": "string",
330
- "buildArguments": [
388
+ "name": "string (required)",
389
+ "type": "string (required)",
390
+ "description": "string",
391
+ "version": "string",
392
+ "buildDetails":
331
393
  {
332
- "name": "string",
333
- "value": "string"
334
- }
335
- ],
336
- "useCache": "boolean",
337
- "dockerfile": "string",
338
- "branch": "string",
339
- "repository": "string",
340
- "token": "string",
341
- "dockerfilePath": "string",
342
- "context": "string"
343
- },
344
- }
394
+ "source": "string",
395
+ "buildArguments": [
396
+ {
397
+ "name": "string",
398
+ "value": "string"
399
+ }
400
+ ],
401
+ "secrets": [],
402
+ "useCache": "boolean",
403
+ "dockerfilePath": "string",
404
+ "context": "string"
405
+ },
406
+ }
407
+
408
+ .. tab:: Github
409
+
410
+ .. code-block:: json
411
+
412
+ {
413
+ "name": "string (required)",
414
+ "type": "string (required)",
415
+ "description": "string",
416
+ "version": "string",
417
+ "buildDetails":
418
+ {
419
+ "source": "string",
420
+ "buildArguments": [
421
+ {
422
+ "name": "string",
423
+ "value": "string"
424
+ }
425
+ ],
426
+ "secrets": [],
427
+ "useCache": "boolean",
428
+ "branch": "string",
429
+ "repository": "string",
430
+ "token": "string",
431
+ "dockerfilePath": "string",
432
+ "context": "string"
433
+ },
434
+ }
435
+
436
+ .. tab:: Dockerfile
437
+
438
+ .. code-block:: json
439
+
440
+ {
441
+ "name": "string (required)",
442
+ "type": "string (required)",
443
+ "description": "string",
444
+ "version": "string",
445
+ "buildDetails":
446
+ {
447
+ "source": "string",
448
+ "buildArguments": [
449
+ {
450
+ "name": "string",
451
+ "value": "string"
452
+ }
453
+ ],
454
+ "secrets": [],
455
+ "useCache": "boolean",
456
+ "dockerfile": "string"
457
+ },
458
+ }
345
459
 
346
460
  Raises:
347
461
  BadRequestException: The given request parameters are invalid.
@@ -451,28 +565,84 @@ class Image(BaseClient):
451
565
  Dict[str, Any]: `imageId`, `buildId`, `versionId` and `autodeploymentId` of the updated version.
452
566
 
453
567
  SCHEMA:
454
- .. code-block:: json
568
+ .. tabs::
569
+
570
+ .. tab:: Upload
571
+
572
+ .. code-block:: json
573
+
574
+ {
575
+ "name": "string (required)",
576
+ "type": "string (required)",
577
+ "description": "string",
578
+ "version": "string",
579
+ "buildDetails":
580
+ {
581
+ "source": "string",
582
+ "buildArguments": [
583
+ {
584
+ "name": "string",
585
+ "value": "string"
586
+ }
587
+ ],
588
+ "secrets": [],
589
+ "useCache": "boolean",
590
+ "dockerfilePath": "string",
591
+ "context": "string"
592
+ },
593
+ }
594
+
595
+ .. tab:: Github
596
+
597
+ .. code-block:: json
598
+
599
+ {
600
+ "name": "string (required)",
601
+ "type": "string (required)",
602
+ "description": "string",
603
+ "version": "string",
604
+ "buildDetails":
605
+ {
606
+ "source": "string",
607
+ "buildArguments": [
608
+ {
609
+ "name": "string",
610
+ "value": "string"
611
+ }
612
+ ],
613
+ "secrets": [],
614
+ "useCache": "boolean",
615
+ "branch": "string",
616
+ "repository": "string",
617
+ "token": "string",
618
+ "dockerfilePath": "string",
619
+ "context": "string"
620
+ },
621
+ }
622
+
623
+ .. tab:: Dockerfile
624
+
625
+ .. code-block:: json
455
626
 
456
- {
457
- "description": "string",
458
- "buildDetails":
459
627
  {
460
- "source": "string",
461
- "buildArguments": [
628
+ "name": "string (required)",
629
+ "type": "string (required)",
630
+ "description": "string",
631
+ "version": "string",
632
+ "buildDetails":
462
633
  {
463
- "name": "string",
464
- "value": "string"
465
- }
466
- ],
467
- "useCache": "boolean",
468
- "dockerfile": "string",
469
- "branch": "string",
470
- "repository": "string",
471
- "token": "string",
472
- "dockerfilePath": "string",
473
- "context": "string"
474
- },
475
- }
634
+ "source": "string",
635
+ "buildArguments": [
636
+ {
637
+ "name": "string",
638
+ "value": "string"
639
+ }
640
+ ],
641
+ "secrets": [],
642
+ "useCache": "boolean",
643
+ "dockerfile": "string"
644
+ },
645
+ }
476
646
 
477
647
  Raises:
478
648
  BadRequestException: The given request parameters are invalid.
@@ -519,31 +689,84 @@ class Image(BaseClient):
519
689
  In case when image and version exists, it will return `buildId` for the updated version along with `imageId` and `versionId` of the existing image / version.
520
690
 
521
691
  SCHEMA:
522
- .. code-block:: json
523
-
524
- {
525
- "name": "string(required)",
526
- "type": "string(required)",
527
- "description": "string",
528
- "version": "string",
529
- "buildDetails":
692
+ .. tabs::
693
+
694
+ .. tab:: Upload
695
+
696
+ .. code-block:: json
697
+
698
+ {
699
+ "name": "string (required)",
700
+ "type": "string (required)",
701
+ "description": "string",
702
+ "version": "string",
703
+ "buildDetails":
704
+ {
705
+ "source": "string",
706
+ "buildArguments": [
707
+ {
708
+ "name": "string",
709
+ "value": "string"
710
+ }
711
+ ],
712
+ "secrets": [],
713
+ "useCache": "boolean",
714
+ "dockerfilePath": "string",
715
+ "context": "string"
716
+ },
717
+ }
718
+
719
+ .. tab:: Github
720
+
721
+ .. code-block:: json
722
+
723
+ {
724
+ "name": "string (required)",
725
+ "type": "string (required)",
726
+ "description": "string",
727
+ "version": "string",
728
+ "buildDetails":
729
+ {
730
+ "source": "string",
731
+ "buildArguments": [
732
+ {
733
+ "name": "string",
734
+ "value": "string"
735
+ }
736
+ ],
737
+ "secrets": [],
738
+ "useCache": "boolean",
739
+ "branch": "string",
740
+ "repository": "string",
741
+ "token": "string",
742
+ "dockerfilePath": "string",
743
+ "context": "string"
744
+ },
745
+ }
746
+
747
+ .. tab:: Dockerfile
748
+
749
+ .. code-block:: json
750
+
530
751
  {
531
- "source": "string",
532
- "buildArguments": [
752
+ "name": "string (required)",
753
+ "type": "string (required)",
754
+ "description": "string",
755
+ "version": "string",
756
+ "buildDetails":
533
757
  {
534
- "name": "string",
535
- "value": "string"
536
- }
537
- ],
538
- "useCache": "boolean",
539
- "dockerfile": "string",
540
- "branch": "string",
541
- "repository": "string",
542
- "token": "string",
543
- "dockerfilePath": "string",
544
- "context": "string"
545
- },
546
- }
758
+ "source": "string",
759
+ "buildArguments": [
760
+ {
761
+ "name": "string",
762
+ "value": "string"
763
+ }
764
+ ],
765
+ "secrets": [],
766
+ "useCache": "boolean",
767
+ "dockerfile": "string"
768
+ },
769
+ }
547
770
 
548
771
  Raises:
549
772
  BadRequestException: The given request parameters are invalid.
@@ -19,9 +19,11 @@ body:
19
19
  - id: existing_block_spec_id_1
20
20
  release:
21
21
  version: 1.0.0
22
+ autoRunOnDeploy: True
22
23
  - id: existing_block_spec_id_2
23
24
  release:
24
25
  version: 1.0.0
26
+ autoRunOnDeploy: False
25
27
  featured: true
26
28
  scope: shared
27
29
  tenants:
@@ -8,6 +8,8 @@ body:
8
8
  - id: existing_block_spec_id_1
9
9
  release:
10
10
  version: 2.0.0
11
+ autoRunOnDeploy: True
11
12
  - id: existing_block_spec_id_2
12
13
  release:
13
14
  version: 2.0.0
15
+ autoRunOnDeploy: False
@@ -0,0 +1,102 @@
1
+ body:
2
+ version: 1
3
+ kind: service
4
+ metadata:
5
+ name: api-service-block
6
+ title: API Service Block
7
+ summary: API Service Block
8
+ description: Creating a new service block spec of type api.
9
+ descriptionContentType: text/markdown
10
+ imageUrl: https://my-block-pics.com/image-0.jpg
11
+ tags:
12
+ - name: CLI
13
+ release:
14
+ version: 1.0.0
15
+ notes: This is the original release
16
+ config:
17
+ serviceType: api
18
+ image:
19
+ dockerfile: Dockerfile
20
+ context: "."
21
+ version: 0.0.1
22
+ parameters:
23
+ env:
24
+ param1: value1
25
+ param2: value2
26
+ secrets:
27
+ - secret1
28
+ - secret2
29
+ resources:
30
+ instanceTypeId: "@param:instance_type_id"
31
+ healthCheckURL: "@param:health_check_url"
32
+ entrypoint: |
33
+ python
34
+ app.py
35
+ minInstances: 1
36
+ parameters:
37
+ build:
38
+ - defaultValue: /health
39
+ description: Enter the health check URL
40
+ name: health_check_url
41
+ required: true
42
+ title: Health Check URL
43
+ type: string
44
+ hideValue: false
45
+ - defaultValue: 20
46
+ description: Select an instance type
47
+ name: instance_type_id
48
+ options:
49
+ - title: Pico (0.125CPU, 0.125GB RAM)
50
+ value: 20
51
+ - title: Nano (0.25CPU, 0.5GB RAM)
52
+ value: 21
53
+ - title: Micro (0.5CPU, 1GB RAM)
54
+ value: 22
55
+ required: true
56
+ title: Instance Type ID
57
+ type: number
58
+ run:
59
+ - defaultValue: AVG
60
+ description: Select an aggregation function (e.g., AVG, SUM, COUNT)
61
+ name: agg_type
62
+ required: false
63
+ title: Agg Type
64
+ type: string
65
+ hideValue: true
66
+ - defaultValue: false
67
+ description: Enable email notifications
68
+ name: email_notifications
69
+ required: false
70
+ title: Email Notifications
71
+ type: boolean
72
+ - defaultValue: 10
73
+ description: Select the number of iterations
74
+ name: num_iterations
75
+ options:
76
+ - title: Low
77
+ value: 10
78
+ - title: Medium
79
+ value: 50
80
+ - title: High
81
+ value: 100
82
+ required: false
83
+ title: Number of Iterations
84
+ type: number
85
+ - defaultValue:
86
+ - input.csv
87
+ - output.csv
88
+ description: Specify input and output file names
89
+ name: file_names
90
+ required: true
91
+ title: File Names
92
+ type: string_array
93
+ artifact:
94
+ path: "."
95
+ ignore_files:
96
+ - ".gitignore"
97
+ - ".dockerignore"
98
+ featured: true
99
+ scope: shared
100
+ tenants:
101
+ - tenant1
102
+ - tenant2
@@ -0,0 +1,88 @@
1
+ # block_spec_release.yaml
2
+
3
+ body:
4
+ release:
5
+ version: 2.0.0
6
+ notes: This is a new release
7
+ config:
8
+ serviceType: api
9
+ image:
10
+ dockerfile: Dockerfile
11
+ context: "."
12
+ version: 0.0.1
13
+ parameters:
14
+ env:
15
+ param1: value1
16
+ param2: value2
17
+ secrets:
18
+ - secret1
19
+ - secret2
20
+ resources:
21
+ instanceTypeId: "@param:instance_type_id"
22
+ healthCheckURL: "@param:health_check_url"
23
+ entrypoint: |
24
+ python
25
+ app.py
26
+ minInstances: 1
27
+ parameters:
28
+ build:
29
+ - defaultValue: /health
30
+ description: Enter the health check URL
31
+ name: health_check_url
32
+ required: true
33
+ title: Health Check URL
34
+ type: string
35
+ hideValue: false
36
+ - defaultValue: 20
37
+ description: Select an instance type
38
+ name: instance_type_id
39
+ options:
40
+ - title: Pico (0.125CPU, 0.125GB RAM)
41
+ value: 20
42
+ - title: Nano (0.25CPU, 0.5GB RAM)
43
+ value: 21
44
+ - title: Micro (0.5CPU, 1GB RAM)
45
+ value: 22
46
+ required: true
47
+ title: Instance Type ID
48
+ type: number
49
+ run:
50
+ - defaultValue: AVG
51
+ description: Select an aggregation function (e.g., AVG, SUM, COUNT)
52
+ name: agg_type
53
+ required: false
54
+ title: Agg Type
55
+ type: string
56
+ hideValue: true
57
+ - defaultValue: false
58
+ description: Enable email notifications
59
+ name: email_notifications
60
+ required: false
61
+ title: Email Notifications
62
+ type: boolean
63
+ - defaultValue: 10
64
+ description: Select the number of iterations
65
+ name: num_iterations
66
+ options:
67
+ - title: Low
68
+ value: 10
69
+ - title: Medium
70
+ value: 50
71
+ - title: High
72
+ value: 100
73
+ required: false
74
+ title: Number of Iterations
75
+ type: number
76
+ - defaultValue:
77
+ - input.csv
78
+ - output.csv
79
+ description: Specify input and output file names
80
+ name: file_names
81
+ required: true
82
+ title: File Names
83
+ type: string_array
84
+ artifact:
85
+ path: "."
86
+ ignore_files:
87
+ - ".gitignore"
88
+ - ".dockerignore"