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.
- peak/_metadata.py +78 -58
- peak/_version.py +1 -1
- peak/callbacks.py +22 -2
- peak/cli/args.py +19 -0
- peak/cli/helpers.py +12 -8
- peak/cli/press/apps/deployments.py +72 -18
- peak/cli/press/apps/specs.py +29 -11
- peak/cli/press/blocks/deployments.py +71 -18
- peak/cli/press/blocks/specs.py +95 -35
- peak/cli/press/deployments.py +40 -1
- peak/cli/press/specs.py +2 -2
- peak/cli/resources/alerts/emails.py +4 -5
- peak/cli/resources/artifacts.py +9 -9
- peak/cli/resources/images.py +29 -18
- peak/cli/resources/services.py +6 -7
- peak/cli/resources/tenants.py +4 -2
- peak/cli/resources/users.py +3 -3
- peak/cli/resources/webapps.py +6 -6
- peak/cli/resources/workflows.py +24 -25
- peak/compression.py +28 -13
- peak/exceptions.py +15 -1
- peak/handler.py +5 -1
- peak/helpers.py +38 -0
- peak/output.py +13 -6
- peak/press/apps.py +43 -3
- peak/press/blocks.py +450 -138
- peak/press/deployments.py +25 -0
- peak/resources/images.py +309 -86
- peak/sample_yaml/press/apps/specs/create_app_spec.yaml +2 -0
- peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml +2 -0
- peak/sample_yaml/press/blocks/specs/service/api/create_block_spec.yaml +102 -0
- peak/sample_yaml/press/blocks/specs/service/api/create_block_spec_release.yaml +88 -0
- peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec.yaml +103 -0
- peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec_release.yaml +89 -0
- peak/sample_yaml/press/blocks/specs/{create_block_spec.yaml → workflow/create_block_spec.yaml} +20 -1
- peak/sample_yaml/press/blocks/specs/{create_block_spec_release.yaml → workflow/create_block_spec_release.yaml} +20 -1
- peak/sample_yaml/resources/images/dockerfile/create_image.yaml +3 -0
- peak/sample_yaml/resources/images/dockerfile/create_image_version.yaml +3 -0
- peak/sample_yaml/resources/images/dockerfile/update_version.yaml +3 -0
- peak/sample_yaml/resources/images/github/create_image.yaml +3 -0
- peak/sample_yaml/resources/images/github/create_image_version.yaml +3 -0
- peak/sample_yaml/resources/images/github/update_version.yaml +3 -0
- peak/sample_yaml/resources/images/upload/create_image.yaml +3 -0
- peak/sample_yaml/resources/images/upload/create_image_version.yaml +3 -0
- peak/sample_yaml/resources/images/upload/create_or_update_image.yaml +3 -0
- peak/sample_yaml/resources/images/upload/update_version.yaml +3 -0
- peak/sample_yaml/resources/workflows/create_or_update_workflow.yaml +9 -1
- peak/sample_yaml/resources/workflows/create_workflow.yaml +9 -1
- peak/sample_yaml/resources/workflows/patch_workflow.yaml +9 -1
- peak/sample_yaml/resources/workflows/update_workflow.yaml +9 -1
- peak/session.py +1 -1
- peak/template.py +21 -2
- {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/METADATA +18 -18
- {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/RECORD +57 -53
- {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/LICENSE +0 -0
- {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/WHEEL +0 -0
- {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/entry_points.txt +0 -0
peak/press/blocks.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
|
"""Blocks client module."""
|
22
|
+
|
22
23
|
from __future__ import annotations
|
23
24
|
|
24
25
|
import json
|
@@ -152,6 +153,7 @@ class Block(BaseClient):
|
|
152
153
|
scope: Optional[str] = None,
|
153
154
|
tenants: Optional[List[str]] = None,
|
154
155
|
parameters: Optional[Dict[str, List[Dict[str, Any]]]] = None,
|
156
|
+
auto_run_on_deploy: Optional[bool] = None,
|
155
157
|
) -> Dict[str, str]:
|
156
158
|
"""Create a new Block spec.
|
157
159
|
|
@@ -171,103 +173,232 @@ class Block(BaseClient):
|
|
171
173
|
and `shared` allows specifying what set of tenants can access and use this spec.
|
172
174
|
By default it is `private`.
|
173
175
|
tenants (List[str] | None): Given a shared scope, specify what other tenants can discover and deploy this spec.
|
174
|
-
parameters (Optional[Dict[str, List[Dict[str, Any]]]]): A dictionary containing optional keys
|
175
|
-
|
176
|
-
-
|
177
|
-
-
|
178
|
-
|
176
|
+
parameters (Optional[Dict[str, List[Dict[str, Any]]]]): A dictionary containing optional keys `build` and `run`. The structure of the dictionary is as follows:
|
177
|
+
|
178
|
+
- `build` (List[Dict[str, Any]], optional): A list of parameter objects, the values of which will be given and used at deployment time.
|
179
|
+
- `run` (List[Dict[str, Any]], optional): A list of parameter objects, the values of which will be given at deployment time and will be used at run time.
|
180
|
+
auto_run_on_deploy (bool | None): Whether to execute the resource after the block is deployed. By default it is False.
|
179
181
|
|
180
182
|
Returns:
|
181
183
|
Dict[str, str]: Id of the created block spec.
|
182
184
|
|
183
|
-
SCHEMA(body):
|
184
|
-
|
185
|
+
SCHEMA (body):
|
186
|
+
Information about providing image details in blocks can be found `here <https://docs.peak.ai/sdk/latest/snippets/press-examples.html#providing-image-details-for-block-specs>`__.
|
185
187
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
"
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
"
|
209
|
-
"
|
210
|
-
"
|
211
|
-
|
212
|
-
|
213
|
-
"
|
214
|
-
"
|
188
|
+
.. tabs::
|
189
|
+
|
190
|
+
.. tab:: Workflow Block Spec
|
191
|
+
|
192
|
+
.. code-block:: json
|
193
|
+
|
194
|
+
{
|
195
|
+
"version": "number(required)",
|
196
|
+
"kind": "string(required)",
|
197
|
+
"metadata": {
|
198
|
+
"name": "string(required)",
|
199
|
+
"title": "string",
|
200
|
+
"summary": "string(required)",
|
201
|
+
"description": "string",
|
202
|
+
"descriptionContentType": "string",
|
203
|
+
"imageUrl": "string",
|
204
|
+
"tags": [
|
205
|
+
{
|
206
|
+
"name": "string",
|
207
|
+
}
|
208
|
+
]
|
209
|
+
},
|
210
|
+
"release": {
|
211
|
+
"notes": "string",
|
212
|
+
"version": "string (required)",
|
213
|
+
},
|
214
|
+
"config": {
|
215
|
+
"images": {
|
216
|
+
"image-name": {
|
217
|
+
"version": "string",
|
218
|
+
"dockerfile": "string",
|
219
|
+
"context": "string",
|
220
|
+
"useCache": "boolean",
|
221
|
+
"buildArguments": {
|
222
|
+
"key (string)": "value (string)"
|
223
|
+
},
|
224
|
+
}
|
215
225
|
},
|
226
|
+
"steps": {
|
227
|
+
"stepName": {
|
228
|
+
"type": "string",
|
229
|
+
"image": {
|
230
|
+
"version": "string",
|
231
|
+
"dockerfile": "string",
|
232
|
+
"context": "string",
|
233
|
+
"useCache": "boolean",
|
234
|
+
"buildArguments": {
|
235
|
+
"key (string)": "value (string)"
|
236
|
+
},
|
237
|
+
"secrets": []
|
238
|
+
}
|
239
|
+
"imageRef": "string",
|
240
|
+
"imageDetails": {
|
241
|
+
"id": "number (required)",
|
242
|
+
"versionId": "number"
|
243
|
+
},
|
244
|
+
"command": "string (required)",
|
245
|
+
"resources": {
|
246
|
+
"instanceTypeId": "number",
|
247
|
+
"storage": "string"
|
248
|
+
},
|
249
|
+
"parents": [],
|
250
|
+
"stepTimeout": "number",
|
251
|
+
"clearImageCache": "boolean",
|
252
|
+
"repository": {
|
253
|
+
"branch": "string",
|
254
|
+
"token": "string",
|
255
|
+
"url": "string"
|
256
|
+
},
|
257
|
+
"runConfiguration": {
|
258
|
+
"retryOptions": {
|
259
|
+
"duration": "number",
|
260
|
+
"exitCodes": [],
|
261
|
+
"exponentialBackoff": "boolean",
|
262
|
+
"numberOfRetries": "number"
|
263
|
+
},
|
264
|
+
"skipConfiguration": {
|
265
|
+
"skip": "boolean",
|
266
|
+
"skipDAG": "boolean",
|
267
|
+
}
|
268
|
+
},
|
269
|
+
"parameters": {
|
270
|
+
"env": {
|
271
|
+
"key (string)": "value (string)"
|
272
|
+
},
|
273
|
+
"secrets": [],
|
274
|
+
},
|
275
|
+
"outputParameters": {
|
276
|
+
"key (string)": "value (string)"
|
277
|
+
},
|
278
|
+
"executionParameters": {
|
279
|
+
"conditional": [
|
280
|
+
{
|
281
|
+
"condition": "string",
|
282
|
+
"paramName": "string",
|
283
|
+
"stepName": "string",
|
284
|
+
"value": "string"
|
285
|
+
}
|
286
|
+
],
|
287
|
+
"parentStatus": [
|
288
|
+
{
|
289
|
+
"condition": "string",
|
290
|
+
"parents": [],
|
291
|
+
"status": []
|
292
|
+
}
|
293
|
+
]
|
294
|
+
}
|
295
|
+
}
|
296
|
+
},
|
297
|
+
"triggers": [
|
298
|
+
{
|
299
|
+
"cron": "string"
|
300
|
+
},
|
301
|
+
{
|
302
|
+
"webhook": "boolean"
|
303
|
+
},
|
304
|
+
],
|
305
|
+
"watchers": [
|
306
|
+
{
|
307
|
+
"events": {
|
308
|
+
"success": "boolean",
|
309
|
+
"fail": "boolean",
|
310
|
+
"runtimeExceeded": "number"
|
311
|
+
},
|
312
|
+
"user": "string",
|
313
|
+
},
|
314
|
+
{
|
315
|
+
"events": {
|
316
|
+
"success": "boolean",
|
317
|
+
"fail": "boolean",
|
318
|
+
"runtimeExceeded": "number"
|
319
|
+
},
|
320
|
+
"webhook": {
|
321
|
+
"name": "string(required)",
|
322
|
+
"url": "string(required)",
|
323
|
+
"payload": "string(required)"
|
324
|
+
}
|
325
|
+
},
|
326
|
+
{
|
327
|
+
"events": {
|
328
|
+
"success": "boolean",
|
329
|
+
"fail": "boolean",
|
330
|
+
"runtimeExceeded": "number"
|
331
|
+
},
|
332
|
+
"email": {
|
333
|
+
"name": "string",
|
334
|
+
"recipients": {
|
335
|
+
"to": ["string"]
|
336
|
+
}
|
337
|
+
}
|
338
|
+
}
|
339
|
+
],
|
216
340
|
}
|
217
|
-
}
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
341
|
+
}
|
342
|
+
|
343
|
+
.. tab:: Service Block Spec
|
344
|
+
|
345
|
+
.. code-block:: json
|
346
|
+
|
347
|
+
{
|
348
|
+
"version": "number(required)",
|
349
|
+
"kind": "string(required)",
|
350
|
+
"metadata": {
|
351
|
+
"name": "string(required)",
|
352
|
+
"title": "string",
|
353
|
+
"summary": "string(required)",
|
354
|
+
"description": "string",
|
355
|
+
"descriptionContentType": "string",
|
356
|
+
"imageUrl": "string",
|
357
|
+
"tags": [
|
358
|
+
{
|
359
|
+
"name": "string",
|
360
|
+
}
|
361
|
+
]
|
362
|
+
},
|
363
|
+
"release": {
|
364
|
+
"notes": "string",
|
365
|
+
"version": "string (required)",
|
366
|
+
},
|
367
|
+
"config": {
|
368
|
+
"serviceType": "string",
|
369
|
+
"image": {
|
370
|
+
"version": "string",
|
371
|
+
"dockerfile": "string",
|
372
|
+
"context": "string",
|
373
|
+
"useCache": "boolean",
|
374
|
+
"buildArguments": {
|
375
|
+
"key (string)": "value (string)"
|
376
|
+
},
|
377
|
+
"secrets": []
|
378
|
+
},
|
379
|
+
"imageDetails": {
|
380
|
+
"id": "number (required)",
|
381
|
+
"versionId": "number"
|
382
|
+
},
|
224
383
|
"resources": {
|
225
|
-
"instanceTypeId": "number",
|
226
|
-
"storage": "string"
|
384
|
+
"instanceTypeId": "number (required)",
|
227
385
|
},
|
228
|
-
"parents": [],
|
229
|
-
"stepTimeout": "number",
|
230
|
-
"clearImageCache": "boolean",
|
231
386
|
"parameters": {
|
232
387
|
"env": {
|
233
388
|
"key (string)": "value (string)"
|
234
389
|
},
|
235
|
-
"secrets": []
|
390
|
+
"secrets": []
|
236
391
|
},
|
237
|
-
"
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
}
|
392
|
+
"sessionStickiness": "boolean (only for web-app service)",
|
393
|
+
"entrypoint": "string",
|
394
|
+
"healthCheckURL": "string",
|
395
|
+
"minInstances": "number. Default is 1 and maximum is 2",
|
242
396
|
}
|
243
397
|
}
|
244
|
-
"triggers": [
|
245
|
-
{
|
246
|
-
"cron": "string"
|
247
|
-
},
|
248
|
-
{
|
249
|
-
"webhook": "boolean"
|
250
|
-
},
|
251
|
-
],
|
252
|
-
"watchers": [
|
253
|
-
{
|
254
|
-
"events": {
|
255
|
-
"success": "boolean",
|
256
|
-
"fail": "boolean",
|
257
|
-
"runtimeExceeded": "number"
|
258
|
-
},
|
259
|
-
"user": "string",
|
260
|
-
"webhook": {
|
261
|
-
"name": "string(required)",
|
262
|
-
"url": "string(required)",
|
263
|
-
"payload": "string(required)",
|
264
|
-
}
|
265
|
-
}
|
266
|
-
],
|
267
|
-
}
|
268
|
-
}
|
269
398
|
|
270
399
|
SCHEMA(Parameters):
|
400
|
+
The valid types for parameters are `boolean`, `string`, `string_array`, `number`, `number_array`, `object` and `object_array`.
|
401
|
+
|
271
402
|
.. code-block:: json
|
272
403
|
|
273
404
|
{ "build": [
|
@@ -309,6 +440,7 @@ class Block(BaseClient):
|
|
309
440
|
"spec": json.dumps(body),
|
310
441
|
"featured": json.dumps(featured),
|
311
442
|
"scope": scope,
|
443
|
+
"autoRunOnDeploy": json.dumps(auto_run_on_deploy),
|
312
444
|
}
|
313
445
|
|
314
446
|
if tenants:
|
@@ -454,6 +586,7 @@ class Block(BaseClient):
|
|
454
586
|
body: Dict[str, Any],
|
455
587
|
artifact: Optional[ArtifactInfo] = None,
|
456
588
|
parameters: Optional[Dict[str, List[Dict[str, Any]]]] = None,
|
589
|
+
auto_run_on_deploy: Optional[bool] = None,
|
457
590
|
) -> Dict[str, str]:
|
458
591
|
"""Publish a new release to an existing Block spec.
|
459
592
|
|
@@ -466,80 +599,226 @@ class Block(BaseClient):
|
|
466
599
|
artifact (ArtifactInfo | None): Mapping of artifact attributes that specifies how the artifact will be generated,
|
467
600
|
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.
|
468
601
|
It is not required if an existing image and version is used for creating the spec.
|
469
|
-
parameters (Optional[Dict[str, List[Dict[str, Any]]]]): A dictionary containing optional keys
|
470
|
-
|
471
|
-
-
|
472
|
-
-
|
602
|
+
parameters (Optional[Dict[str, List[Dict[str, Any]]]]): A dictionary containing optional keys `build` and `run`. The structure of the dictionary is as follows:
|
603
|
+
|
604
|
+
- `build` (List[Dict[str, Any]], optional): A list of parameter objects, the values of which will be given and used at deployment time.
|
605
|
+
- `run` (List[Dict[str, Any]], optional): A list of parameter objects, the values of which will be given at deployment time and will be used at run time.
|
606
|
+
auto_run_on_deploy (bool | None): Whether to execute the resource after the block is deployed. By default it is False.
|
473
607
|
|
474
608
|
Returns:
|
475
|
-
Dict[str, str]: Dictionary containing spec id and release version
|
609
|
+
Dict[str, str]: Dictionary containing spec id and release version.
|
476
610
|
|
477
|
-
SCHEMA:
|
478
|
-
|
611
|
+
SCHEMA (body):
|
612
|
+
Information about providing image details in blocks can be found `here <https://docs.peak.ai/sdk/latest/snippets/press-examples.html#providing-image-details-for-block-specs>`__.
|
479
613
|
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
"
|
489
|
-
|
614
|
+
.. tabs::
|
615
|
+
|
616
|
+
.. tab:: Workflow Block Spec
|
617
|
+
|
618
|
+
.. code-block:: json
|
619
|
+
|
620
|
+
{
|
621
|
+
"release": {
|
622
|
+
"notes": "string",
|
623
|
+
"version": "string (required)",
|
624
|
+
},
|
625
|
+
"config": {
|
626
|
+
"images": {
|
627
|
+
"image-name": {
|
628
|
+
"version": "string",
|
629
|
+
"dockerfile": "string",
|
630
|
+
"context": "string",
|
631
|
+
"useCache": "boolean",
|
632
|
+
"buildArguments": {
|
633
|
+
"key (string)": "value (string)"
|
634
|
+
},
|
635
|
+
}
|
636
|
+
},
|
637
|
+
"steps": {
|
638
|
+
"stepName": {
|
639
|
+
"type": "string",
|
640
|
+
"image": {
|
641
|
+
"version": "string",
|
642
|
+
"dockerfile": "string",
|
643
|
+
"context": "string",
|
644
|
+
"useCache": "boolean",
|
645
|
+
"buildArguments": {
|
646
|
+
"key (string)": "value (string)"
|
647
|
+
},
|
648
|
+
"secrets": []
|
649
|
+
}
|
650
|
+
"imageRef": "string",
|
651
|
+
"imageDetails": {
|
652
|
+
"id": "number (required)",
|
653
|
+
"versionId": "number"
|
654
|
+
},
|
655
|
+
"command": "string (required)",
|
656
|
+
"resources": {
|
657
|
+
"instanceTypeId": "number",
|
658
|
+
"storage": "string"
|
659
|
+
},
|
660
|
+
"parents": [],
|
661
|
+
"stepTimeout": "number",
|
662
|
+
"clearImageCache": "boolean",
|
663
|
+
"repository": {
|
664
|
+
"branch": "string",
|
665
|
+
"token": "string",
|
666
|
+
"url": "string"
|
667
|
+
},
|
668
|
+
"runConfiguration": {
|
669
|
+
"retryOptions": {
|
670
|
+
"duration": "number",
|
671
|
+
"exitCodes": [],
|
672
|
+
"exponentialBackoff": "boolean",
|
673
|
+
"numberOfRetries": "number"
|
674
|
+
},
|
675
|
+
"skipConfiguration": {
|
676
|
+
"skip": "boolean",
|
677
|
+
"skipDAG": "boolean",
|
678
|
+
}
|
679
|
+
},
|
680
|
+
"parameters": {
|
681
|
+
"env": {
|
682
|
+
"key (string)": "value (string)"
|
683
|
+
},
|
684
|
+
"secrets": [],
|
685
|
+
},
|
686
|
+
"outputParameters": {
|
687
|
+
"key (string)": "value (string)"
|
688
|
+
},
|
689
|
+
"executionParameters": {
|
690
|
+
"conditional": [
|
691
|
+
{
|
692
|
+
"condition": "string",
|
693
|
+
"paramName": "string",
|
694
|
+
"stepName": "string",
|
695
|
+
"value": "string"
|
696
|
+
}
|
697
|
+
],
|
698
|
+
"parentStatus": [
|
699
|
+
{
|
700
|
+
"condition": "string",
|
701
|
+
"parents": [],
|
702
|
+
"status": []
|
703
|
+
}
|
704
|
+
]
|
705
|
+
}
|
706
|
+
}
|
490
707
|
},
|
708
|
+
"triggers": [
|
709
|
+
{
|
710
|
+
"cron": "string"
|
711
|
+
},
|
712
|
+
{
|
713
|
+
"webhook": "boolean"
|
714
|
+
}
|
715
|
+
],
|
716
|
+
"watchers": [
|
717
|
+
{
|
718
|
+
"events": {
|
719
|
+
"success": "boolean",
|
720
|
+
"fail": "boolean",
|
721
|
+
"runtimeExceeded": "number"
|
722
|
+
},
|
723
|
+
"user": "string",
|
724
|
+
},
|
725
|
+
{
|
726
|
+
"events": {
|
727
|
+
"success": "boolean",
|
728
|
+
"fail": "boolean",
|
729
|
+
"runtimeExceeded": "number"
|
730
|
+
},
|
731
|
+
"webhook": {
|
732
|
+
"name": "string(required)",
|
733
|
+
"url": "string(required)",
|
734
|
+
"payload": "string(required)"
|
735
|
+
}
|
736
|
+
},
|
737
|
+
{
|
738
|
+
"events": {
|
739
|
+
"success": "boolean",
|
740
|
+
"fail": "boolean",
|
741
|
+
"runtimeExceeded": "number"
|
742
|
+
},
|
743
|
+
"email": {
|
744
|
+
"name": "string",
|
745
|
+
"recipients": {
|
746
|
+
"to": ["string"]
|
747
|
+
}
|
748
|
+
}
|
749
|
+
}
|
750
|
+
],
|
491
751
|
}
|
492
|
-
}
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
752
|
+
}
|
753
|
+
|
754
|
+
.. tab:: Service Block Spec
|
755
|
+
|
756
|
+
.. code-block:: json
|
757
|
+
|
758
|
+
{
|
759
|
+
"release": {
|
760
|
+
"notes": "string",
|
761
|
+
"version": "string (required)",
|
762
|
+
},
|
763
|
+
"config": {
|
764
|
+
"serviceType": "string",
|
765
|
+
"image": {
|
766
|
+
"version": "string",
|
767
|
+
"dockerfile": "string",
|
768
|
+
"context": "string",
|
769
|
+
"useCache": "boolean",
|
770
|
+
"buildArguments": {
|
771
|
+
"key (string)": "value (string)"
|
772
|
+
},
|
773
|
+
"secrets": []
|
774
|
+
},
|
775
|
+
"imageDetails": {
|
776
|
+
"id": "number (required)",
|
777
|
+
"versionId": "number"
|
778
|
+
},
|
499
779
|
"resources": {
|
500
|
-
"instanceTypeId": "number",
|
501
|
-
"storage": "string"
|
780
|
+
"instanceTypeId": "number (required)",
|
502
781
|
},
|
503
|
-
"parents": [],
|
504
|
-
"stepTimeout": "number",
|
505
|
-
"clearImageCache": "boolean",
|
506
782
|
"parameters": {
|
507
783
|
"env": {
|
508
784
|
"key (string)": "value (string)"
|
509
785
|
},
|
510
|
-
"secrets": []
|
786
|
+
"secrets": []
|
511
787
|
},
|
512
|
-
"
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
}
|
788
|
+
"sessionStickiness": "boolean (only for web-app service)",
|
789
|
+
"entrypoint": "string",
|
790
|
+
"healthCheckURL": "string",
|
791
|
+
"minInstances": "number. Default is 1 and maximum is 2",
|
517
792
|
}
|
518
793
|
}
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
794
|
+
|
795
|
+
SCHEMA(Parameters):
|
796
|
+
The valid types for parameters are `boolean`, `string`, `string_array`, `number`, `number_array`, `object` and `object_array`.
|
797
|
+
|
798
|
+
.. code-block:: json
|
799
|
+
|
800
|
+
{ "build": [
|
801
|
+
{
|
802
|
+
"defaultValue": "string(required)",
|
803
|
+
"description": "string",
|
804
|
+
"hideValue": "boolean",
|
805
|
+
"name": "string(required)",
|
806
|
+
"required": "boolean(required)",
|
807
|
+
"title": "string",
|
808
|
+
"type": "string(required)",
|
809
|
+
}
|
810
|
+
],
|
811
|
+
"run": [
|
812
|
+
{
|
813
|
+
"defaultValue": "string(required)",
|
814
|
+
"description": "string",
|
815
|
+
"hideValue": "boolean",
|
816
|
+
"name": "string(required)",
|
817
|
+
"required": "boolean(required)",
|
818
|
+
"title": "string",
|
819
|
+
"type": "string(required)",
|
820
|
+
}
|
821
|
+
]
|
543
822
|
}
|
544
823
|
|
545
824
|
Raises:
|
@@ -556,6 +835,7 @@ class Block(BaseClient):
|
|
556
835
|
|
557
836
|
request_body = {
|
558
837
|
"spec": json.dumps(body),
|
838
|
+
"autoRunOnDeploy": json.dumps(auto_run_on_deploy),
|
559
839
|
}
|
560
840
|
|
561
841
|
if parameters:
|
@@ -938,6 +1218,38 @@ class Block(BaseClient):
|
|
938
1218
|
subdomain="press",
|
939
1219
|
)
|
940
1220
|
|
1221
|
+
def redeploy(self, deployment_id: str) -> Dict[str, Any]:
|
1222
|
+
"""Redeploy latest revision of an existing Block deployment.
|
1223
|
+
|
1224
|
+
This function allows you to redeploy a Block deployment that is in `failed` or `warning` state.
|
1225
|
+
|
1226
|
+
REFERENCE:
|
1227
|
+
🔗 `API Documentation <https://press.peak.ai/api-docs/index.htm#/Block%20Deployments/post_v1_blocks_deployments__deploymentId__redeploy>`__
|
1228
|
+
|
1229
|
+
Args:
|
1230
|
+
deployment_id (str): The ID of the Block deployment to redeploy.
|
1231
|
+
|
1232
|
+
Returns:
|
1233
|
+
Dict[str, Any]: A dictionary containing details of the deployment.
|
1234
|
+
|
1235
|
+
Raises:
|
1236
|
+
BadRequestException: The given parameters are invalid.
|
1237
|
+
ConflictException: There is a conflict with the current state of the target resource.
|
1238
|
+
ForbiddenException: The user does not have permission to perform the operation.
|
1239
|
+
InternalServerErrorException: The server encountered an unexpected condition that
|
1240
|
+
prevented it from fulfilling the request.
|
1241
|
+
NotFoundException: The given block deployment or its revisions do not exist.
|
1242
|
+
UnauthorizedException: The credentials are invalid.
|
1243
|
+
"""
|
1244
|
+
method, endpoint = HttpMethods.POST, f"{self.DEPLOYMENTS_BASE_ENDPOINT}/{deployment_id}/redeploy"
|
1245
|
+
|
1246
|
+
return self.session.create_request( # type: ignore[no-any-return]
|
1247
|
+
endpoint,
|
1248
|
+
method,
|
1249
|
+
content_type=ContentType.APPLICATION_JSON,
|
1250
|
+
subdomain="press",
|
1251
|
+
)
|
1252
|
+
|
941
1253
|
def delete_deployment(self, deployment_id: str) -> Dict[None, None]:
|
942
1254
|
"""Deletes the Block deployment.
|
943
1255
|
|