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/cli/press/blocks/specs.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
|
"""Peak blocks specs commands."""
|
22
|
+
|
22
23
|
from typing import Dict, List, Optional
|
23
24
|
|
24
25
|
import typer
|
@@ -35,7 +36,7 @@ console = Console()
|
|
35
36
|
_SPEC_ID = typer.Argument(..., help="ID of the Block spec to be used in this operation.")
|
36
37
|
|
37
38
|
|
38
|
-
@app.command("list", short_help="List Block specs."
|
39
|
+
@app.command("list", short_help="List Block specs.")
|
39
40
|
def list_block_specs(
|
40
41
|
ctx: typer.Context,
|
41
42
|
page_size: Optional[int] = args.PAGE_SIZE,
|
@@ -89,11 +90,12 @@ def list_block_specs(
|
|
89
90
|
writer.write(response)
|
90
91
|
|
91
92
|
|
92
|
-
@app.command(short_help="Create a Block spec."
|
93
|
+
@app.command(short_help="Create a Block spec.")
|
93
94
|
def create(
|
94
95
|
ctx: typer.Context,
|
95
96
|
file: str = args.TEMPLATE_PATH,
|
96
97
|
description_file: Optional[str] = args.TEMPLATE_DESCRIPTION_FILE,
|
98
|
+
release_notes_file: Optional[str] = args.RELEASE_NOTES_FILE,
|
97
99
|
params_file: Optional[str] = args.TEMPLATE_PARAMS_FILE,
|
98
100
|
params: Optional[List[str]] = args.TEMPLATE_PARAMS,
|
99
101
|
dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
|
@@ -109,6 +111,7 @@ def create(
|
|
109
111
|
featured (bool | required: false): Boolean specifying whether to feature this spec.
|
110
112
|
scope (str | required: false): Specify what tenants can discover and deploy this spec.
|
111
113
|
tenants (list(str) | required: false): Given a shared scope, specify what other tenants can discover and deploy this spec.
|
114
|
+
autoRunOnDeploy (bool | required: false): Whether to execute the resource after the block is deployed. By default it is False.
|
112
115
|
body (map):
|
113
116
|
version (int): Version of the spec.
|
114
117
|
kind (string): Specifies the type of spec.
|
@@ -124,8 +127,8 @@ def create(
|
|
124
127
|
release (map):
|
125
128
|
version (string): A valid semantic release version of the spec.
|
126
129
|
notes (string | required: false): Notes for the release version.
|
127
|
-
config (map):
|
128
|
-
images(map | required: false):
|
130
|
+
config (map): # For Workflow Block
|
131
|
+
images(map | required: false):
|
129
132
|
image-name (map): Dictionary containing the image configuration. Here the key is name of the image.
|
130
133
|
version (string | required: false): A valid semantic image version.
|
131
134
|
dockerfile (string | required: false): Path to the Dockerfile inside artifact.
|
@@ -133,7 +136,7 @@ def create(
|
|
133
136
|
useCache (boolean | required: false): Whether to enable image caching to reduce build time, is enabled by default.
|
134
137
|
buildArguments (map | required: false): Dictionary containing build args. Here the key is the name of the arg and value is the value of the arg.
|
135
138
|
secrets (list(str)) | required: false): List of secret names to be passed.
|
136
|
-
steps (map | required: false):
|
139
|
+
steps (map | required: false):
|
137
140
|
<stepName> (map): Dictionary containing the step configuration. Here the key is name of the step.
|
138
141
|
image: (map | required: false):
|
139
142
|
version (string | required: false): A valid semantic image version.
|
@@ -170,28 +173,48 @@ def create(
|
|
170
173
|
success (boolean | required: false): Whether to call event on success.
|
171
174
|
fail (boolean | required: false): Whether to call event on failure.
|
172
175
|
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
173
|
-
user (string
|
174
|
-
|
176
|
+
user (string): User to be notified.
|
177
|
+
- events (map):
|
178
|
+
success (boolean | required: false): Whether to call event on success.
|
179
|
+
fail (boolean | required: false): Whether to call event on failure.
|
180
|
+
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
181
|
+
webhook (map):
|
175
182
|
name (string): Name of the webhook.
|
176
183
|
url (string): URL of the webhook.
|
177
184
|
payload (string): Webhook payload.
|
178
|
-
|
185
|
+
- events (map):
|
186
|
+
success (boolean | required: false): Whether to call event on success.
|
187
|
+
fail (boolean | required: false): Whether to call event on failure.
|
188
|
+
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
189
|
+
email (map):
|
190
|
+
name (string): Name of the email watcher.
|
191
|
+
recipients (map):
|
192
|
+
to (list(str)): List of email addresses to send the email to. Email can be sent only to the users who are added in the tenant.
|
193
|
+
config (map): # For Service Block. One of "image" or "imageDetails" is required.
|
194
|
+
serviceType (string): Type of the service. Should be one of "web-app" or "api". It is "web-app" by default.
|
195
|
+
image (map | required: false):
|
179
196
|
version (string | required: false): A valid semantic image version.
|
180
197
|
dockerfile (string | required: false): Path to the Dockerfile inside artifact.
|
181
198
|
context (string | required: false): The path within the artifact where the code to be executed by the Dockerfile is located.
|
182
199
|
useCache (boolean | required: false): Whether to enable image caching to reduce build time, is enabled by default.
|
183
200
|
buildArguments (map | required: false): Dictionary containing build args. Here the key is the name of the arg and value is the value of the arg.
|
184
201
|
secrets (list(str)) | required: false): List of secret names to be passed.
|
185
|
-
imageDetails (map | required: false):
|
202
|
+
imageDetails (map | required: false):
|
186
203
|
id (int): ID of the existing image.
|
187
|
-
versionId: (int): ID of the existing image version.
|
188
|
-
resources (map | required: false): To be used only in case of
|
189
|
-
instanceTypeId (int): ID of the instance type to be used in the
|
190
|
-
|
204
|
+
versionId: (int | required: false): ID of the existing image version. If not provided, the latest version will be used.
|
205
|
+
resources (map | required: false): To be used only in case of service block.
|
206
|
+
instanceTypeId (int): ID of the instance type to be used in the service block.
|
207
|
+
parameters (map | required: false):
|
208
|
+
env (map | required: false): Key-Value pair where key is the name of the env.
|
209
|
+
secrets (list(str) | required: false): List of secret names to be passed.
|
210
|
+
sessionStickiness (boolean | required: false): Whether to enable session stickiness for the service. It is false by default. To be used only in case of service block of type web-app.
|
211
|
+
entrypoint (string | required: false): Entry point for the service.
|
212
|
+
healthCheckURL (string | required: false): URL to check the health of the service.
|
213
|
+
minInstances (number | required: false): Minimum number of instances that would run for a service. Default value is 1 and maximum value allowed is 2.
|
191
214
|
parameters (map | required: false):
|
192
215
|
<parameterType> (list(map)): List containing the parameter objects. Here the key is the type of the parameter. Accepted values are "build" or "run".
|
193
216
|
name (string): Name of the parameter.
|
194
|
-
type (string): Type of the parameter. Should be one of "string", "number", "
|
217
|
+
type (string): Type of the parameter. Should be one of "boolean", "string", "string_array", "number", "number_array", "object" and "object_array".
|
195
218
|
required (boolean): Whether the parameter is required.
|
196
219
|
description (string | required: false): Description of the parameter.
|
197
220
|
defaultValue (string | required: false): Default value of the parameter.
|
@@ -222,7 +245,13 @@ def create(
|
|
222
245
|
block_client: Block = ctx.obj["client"]
|
223
246
|
writer: Writer = ctx.obj["writer"]
|
224
247
|
|
225
|
-
|
248
|
+
markdown_files = {}
|
249
|
+
if description_file:
|
250
|
+
markdown_files["body:metadata:description"] = description_file
|
251
|
+
if release_notes_file:
|
252
|
+
markdown_files["body:release:notes"] = release_notes_file
|
253
|
+
|
254
|
+
body = helpers.template_handler(file, params_file, params, markdown_files)
|
226
255
|
body = helpers.remove_unknown_args(body, block_client.create_spec)
|
227
256
|
|
228
257
|
with writer.pager():
|
@@ -230,7 +259,7 @@ def create(
|
|
230
259
|
writer.write(response)
|
231
260
|
|
232
261
|
|
233
|
-
@app.command(short_help="Describe a Block spec."
|
262
|
+
@app.command(short_help="Describe a Block spec.")
|
234
263
|
def describe(
|
235
264
|
ctx: typer.Context,
|
236
265
|
spec_id: str = _SPEC_ID,
|
@@ -269,7 +298,7 @@ def describe(
|
|
269
298
|
writer.write(response)
|
270
299
|
|
271
300
|
|
272
|
-
@app.command(short_help="Update the Block spec metadata."
|
301
|
+
@app.command(short_help="Update the Block spec metadata.")
|
273
302
|
def update_metadata(
|
274
303
|
ctx: typer.Context,
|
275
304
|
spec_id: str = _SPEC_ID,
|
@@ -324,7 +353,11 @@ def update_metadata(
|
|
324
353
|
|
325
354
|
🔗 [**API Documentation**](https://press.peak.ai/api-docs/index.htm#/Block%20Specs/patch_v1_blocks_specs__specId_)
|
326
355
|
"""
|
327
|
-
|
356
|
+
markdown_files = {}
|
357
|
+
if description_file:
|
358
|
+
markdown_files["body:metadata:description"] = description_file
|
359
|
+
|
360
|
+
body = helpers.template_handler(file, params_file, params, markdown_files)
|
328
361
|
writer: Writer = ctx.obj["writer"]
|
329
362
|
|
330
363
|
block_client: Block = ctx.obj["client"]
|
@@ -335,7 +368,7 @@ def update_metadata(
|
|
335
368
|
writer.write(response)
|
336
369
|
|
337
370
|
|
338
|
-
@app.command(short_help="Delete a Block spec."
|
371
|
+
@app.command(short_help="Delete a Block spec.")
|
339
372
|
def delete(
|
340
373
|
ctx: typer.Context,
|
341
374
|
spec_id: str = _SPEC_ID,
|
@@ -367,11 +400,12 @@ def delete(
|
|
367
400
|
writer.write(response)
|
368
401
|
|
369
402
|
|
370
|
-
@app.command(short_help="Create a new release for a Block spec."
|
403
|
+
@app.command(short_help="Create a new release for a Block spec.")
|
371
404
|
def create_release(
|
372
405
|
ctx: typer.Context,
|
373
406
|
spec_id: str = _SPEC_ID,
|
374
407
|
file: str = args.TEMPLATE_PATH,
|
408
|
+
release_notes_file: Optional[str] = args.RELEASE_NOTES_FILE,
|
375
409
|
params_file: Optional[str] = args.TEMPLATE_PARAMS_FILE,
|
376
410
|
params: Optional[List[str]] = args.TEMPLATE_PARAMS,
|
377
411
|
dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
|
@@ -388,8 +422,8 @@ def create_release(
|
|
388
422
|
release (map):
|
389
423
|
version (string): A valid semantic release version of the spec. Must be greater than previous release version.
|
390
424
|
notes (string | required: false): Notes for the release version.
|
391
|
-
config (map):
|
392
|
-
images(map | required: false):
|
425
|
+
config (map): # For Workflow Block
|
426
|
+
images(map | required: false):
|
393
427
|
image-name(map): Dictionary containing the image configuration. Here the key is name of the image.
|
394
428
|
version (string | required: false): A valid semantic image version.
|
395
429
|
dockerfile (string | required: false): Path to the Dockerfile inside artifact.
|
@@ -397,7 +431,7 @@ def create_release(
|
|
397
431
|
useCache (boolean | required: false): Whether to enable image caching to reduce build time, is enabled by default.
|
398
432
|
buildArguments (map | required: false): Dictionary containing build args. Here the key is the name of the arg and value is the value of the arg.
|
399
433
|
secrets (list(str)) | required: false): List of secret names to be passed.
|
400
|
-
steps(map | required: false):
|
434
|
+
steps(map | required: false):
|
401
435
|
<stepName> (map): Dictionary containing the step configuration. Here the key is name of the step.
|
402
436
|
image: (map | required: false):
|
403
437
|
version (string | required: false): A valid semantic image version.
|
@@ -434,28 +468,48 @@ def create_release(
|
|
434
468
|
success (boolean | required: false): Whether to call event on success.
|
435
469
|
fail (boolean | required: false): Whether to call event on failure.
|
436
470
|
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
437
|
-
user (string
|
438
|
-
|
471
|
+
user (string): User to be notified.
|
472
|
+
- events (map):
|
473
|
+
success (boolean | required: false): Whether to call event on success.
|
474
|
+
fail (boolean | required: false): Whether to call event on failure.
|
475
|
+
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
476
|
+
webhook (map):
|
439
477
|
name (string): Name of the webhook.
|
440
478
|
url (string): URL of the webhook.
|
441
479
|
payload (string): Webhook payload.
|
442
|
-
|
480
|
+
- events (map):
|
481
|
+
success (boolean | required: false): Whether to call event on success.
|
482
|
+
fail (boolean | required: false): Whether to call event on failure.
|
483
|
+
runtimeExceeded (int | required: false): The runtime in minutes after which event is called.
|
484
|
+
email (map):
|
485
|
+
name (string): Name of the email watcher.
|
486
|
+
recipients (map):
|
487
|
+
to (list(str)): List of email addresses to send the email to. Email can be sent only to the users who are added in the tenant.
|
488
|
+
config (map): # For Service Block. One of "image" or "imageDetails" is required.
|
489
|
+
serviceType (string): Type of the service. Should be one of "web-app" or "api". It is "web-app" by default.
|
490
|
+
image (map | required: false):
|
443
491
|
version (string | required: false): A valid semantic image version.
|
444
492
|
dockerfile (string | required: false): Path to the Dockerfile inside artifact.
|
445
493
|
context (string | required: false): The path within the artifact where the code to be executed by the Dockerfile is located.
|
446
494
|
useCache (boolean | required: false): Whether to enable image caching to reduce build time, is enabled by default.
|
447
495
|
buildArguments (map | required: false): Dictionary containing build args. Here the key is the name of the arg and value is the value of the arg.
|
448
496
|
secrets (list(str)) | required: false): List of secret names to be passed.
|
449
|
-
imageDetails (map | required: false):
|
497
|
+
imageDetails (map | required: false):
|
450
498
|
id (int): ID of the existing image.
|
451
|
-
versionId: (int): ID of the existing image version.
|
452
|
-
resources (map | required: false):
|
453
|
-
instanceTypeId (int): ID of the instance type to be used in the
|
454
|
-
|
499
|
+
versionId: (int | required: false): ID of the existing image version. If not provided, the latest version will be used.
|
500
|
+
resources (map | required: false):
|
501
|
+
instanceTypeId (int): ID of the instance type to be used in the service block.
|
502
|
+
parameters (map | required: false):
|
503
|
+
env (map | required: false): Key-Value pair where key is the name of the env.
|
504
|
+
secrets (list(str) | required: false): List of secret names to be passed.
|
505
|
+
sessionStickiness (boolean | required: false): Whether to enable session stickiness for the service. It is false by default. To be used only in case of service block of type web-app.
|
506
|
+
entrypoint (string | required: false): Entry point for the service.
|
507
|
+
healthCheckURL (string | required: false): URL to check the health of the service.
|
508
|
+
minInstances (number | required: false): Minimum number of instances that would run for a service. Default value is 1 and maximum value allowed is 2.
|
455
509
|
parameters (map | required: false):
|
456
510
|
<parameterType> (list(map)): List containing the parameter objects. Here the key is the type of the parameter. Accepted values are "build" or "run".
|
457
511
|
name (string): Name of the parameter.
|
458
|
-
type (string): Type of the parameter. Should be one of "string", "number", "
|
512
|
+
type (string): Type of the parameter. Should be one of "boolean", "string", "string_array", "number", "number_array", "object" and "object_array".
|
459
513
|
required (boolean): Whether the parameter is required.
|
460
514
|
description (string | required: false): Description of the parameter.
|
461
515
|
defaultValue (string | required: false): Default value of the parameter.
|
@@ -464,6 +518,7 @@ def create_release(
|
|
464
518
|
artifact (map | required: false):
|
465
519
|
path (str): Path to the artifact.
|
466
520
|
ignore_files (list(str) | required: false) : Ignore files to use when creating artifact.
|
521
|
+
autoRunOnDeploy (bool | required: false): Whether to execute the resource after the block is deployed. By default it is False.
|
467
522
|
```
|
468
523
|
|
469
524
|
\b
|
@@ -485,7 +540,11 @@ def create_release(
|
|
485
540
|
|
486
541
|
🔗 [**API Documentation**](https://press.peak.ai/api-docs/index.htm#/Block%20Specs/post_v1_blocks_specs__specId__releases)
|
487
542
|
"""
|
488
|
-
|
543
|
+
markdown_files = {}
|
544
|
+
if release_notes_file:
|
545
|
+
markdown_files["body:release:notes"] = release_notes_file
|
546
|
+
|
547
|
+
body = helpers.template_handler(file, params_file, params, markdown_files)
|
489
548
|
writer: Writer = ctx.obj["writer"]
|
490
549
|
|
491
550
|
block_client: Block = ctx.obj["client"]
|
@@ -496,7 +555,7 @@ def create_release(
|
|
496
555
|
writer.write(response)
|
497
556
|
|
498
557
|
|
499
|
-
@app.command(short_help="Describe a Block spec release."
|
558
|
+
@app.command(short_help="Describe a Block spec release.")
|
500
559
|
def describe_release(
|
501
560
|
ctx: typer.Context,
|
502
561
|
spec_id: str = args.SPEC_ID,
|
@@ -534,6 +593,7 @@ def describe_release(
|
|
534
593
|
"createdBy": "someoneh@peak.ai",
|
535
594
|
"id": "df113d64-ff44-4aa0-9278-edb03dae7a3f",
|
536
595
|
"notes": "This is the original release",
|
596
|
+
"autoRunOnDeploy": false,
|
537
597
|
"parameters": {...},
|
538
598
|
}
|
539
599
|
```
|
@@ -548,7 +608,7 @@ def describe_release(
|
|
548
608
|
writer.write(response)
|
549
609
|
|
550
610
|
|
551
|
-
@app.command(short_help="List releases of a Block spec."
|
611
|
+
@app.command(short_help="List releases of a Block spec.")
|
552
612
|
def list_releases(
|
553
613
|
ctx: typer.Context,
|
554
614
|
spec_id: str = args.SPEC_ID,
|
peak/cli/press/deployments.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
|
"""Peak deployments commands."""
|
22
|
+
|
22
23
|
from typing import List, Optional
|
23
24
|
|
24
25
|
import typer
|
@@ -36,7 +37,7 @@ app = typer.Typer(
|
|
36
37
|
console = Console()
|
37
38
|
|
38
39
|
|
39
|
-
@app.command("list", short_help="List App and Block deployments."
|
40
|
+
@app.command("list", short_help="List App and Block deployments.")
|
40
41
|
def list_deployments(
|
41
42
|
ctx: typer.Context,
|
42
43
|
page_size: Optional[int] = args.PAGE_SIZE,
|
@@ -84,3 +85,41 @@ def list_deployments(
|
|
84
85
|
return_iterator=False,
|
85
86
|
)
|
86
87
|
writer.write(response)
|
88
|
+
|
89
|
+
|
90
|
+
@app.command(short_help="Execute the resources of an app or block deployment")
|
91
|
+
def execute_resources(
|
92
|
+
ctx: typer.Context,
|
93
|
+
deployment_id: str = typer.Argument(..., help="ID of the app or block deployment to execute resources for."),
|
94
|
+
paging: Optional[bool] = PAGING, # noqa: ARG001
|
95
|
+
output_type: Optional[OutputTypes] = OUTPUT_TYPES, # noqa: ARG001
|
96
|
+
) -> None:
|
97
|
+
"""***Execute*** the resources of an app or block deployment. This will execute the resources of the latest revision of the deployment for which `autoRunOnDeploy` property is enabled.
|
98
|
+
|
99
|
+
\b
|
100
|
+
📝 ***Example usage:***<br/>
|
101
|
+
```bash
|
102
|
+
peak deployments execute-resources <deployment_id>
|
103
|
+
```
|
104
|
+
|
105
|
+
\b
|
106
|
+
🆗 ***Response:***
|
107
|
+
```
|
108
|
+
{
|
109
|
+
"executeResponse": [
|
110
|
+
{
|
111
|
+
"blockSpecId": "0bddb4c6-40c5-45c3-b477-fceb2c051609",
|
112
|
+
"version": "1.0.0",
|
113
|
+
"executionId": "a3e77006-86f3-4829-8c43-f21ad462dbbd",
|
114
|
+
"status": "executed"
|
115
|
+
}
|
116
|
+
]
|
117
|
+
}
|
118
|
+
```
|
119
|
+
"""
|
120
|
+
deployment_client: Deployment = ctx.obj["client"]
|
121
|
+
writer: Writer = ctx.obj["writer"]
|
122
|
+
|
123
|
+
with writer.pager():
|
124
|
+
response = deployment_client.execute_resources(deployment_id)
|
125
|
+
writer.write(response)
|
peak/cli/press/specs.py
CHANGED
@@ -38,7 +38,7 @@ console = Console()
|
|
38
38
|
RELEASE_VERSION = typer.Option(None, help="The release version of the spec in valid semantic versioning format.")
|
39
39
|
|
40
40
|
|
41
|
-
@app.command("list", short_help="List App and Block specs."
|
41
|
+
@app.command("list", short_help="List App and Block specs.")
|
42
42
|
def list_specs(
|
43
43
|
ctx: typer.Context,
|
44
44
|
page_size: Optional[int] = args.PAGE_SIZE,
|
@@ -92,7 +92,7 @@ def list_specs(
|
|
92
92
|
writer.write(response)
|
93
93
|
|
94
94
|
|
95
|
-
@app.command(short_help="List deployments for a spec release."
|
95
|
+
@app.command(short_help="List deployments for a spec release.")
|
96
96
|
def list_release_deployments(
|
97
97
|
ctx: typer.Context,
|
98
98
|
spec_id: str = args.SPEC_ID,
|
@@ -57,7 +57,7 @@ _LIST_TEMPLATE_SCOPE = typer.Option(None, help="List of type of template to filt
|
|
57
57
|
_DESCRIBE_TEMPLATE_NAME = typer.Argument(None, help="The name of the email template.")
|
58
58
|
|
59
59
|
|
60
|
-
@app.command("list", short_help="List all emails."
|
60
|
+
@app.command("list", short_help="List all emails.")
|
61
61
|
def list_emails(
|
62
62
|
ctx: typer.Context,
|
63
63
|
page_size: Optional[int] = _PAGE_SIZE,
|
@@ -114,7 +114,7 @@ def list_emails(
|
|
114
114
|
writer.write(response)
|
115
115
|
|
116
116
|
|
117
|
-
@app.command("send", short_help="Send an email."
|
117
|
+
@app.command("send", short_help="Send an email.")
|
118
118
|
def send_email(
|
119
119
|
ctx: typer.Context,
|
120
120
|
file: Annotated[
|
@@ -213,7 +213,7 @@ def send_email(
|
|
213
213
|
writer.write(response)
|
214
214
|
|
215
215
|
|
216
|
-
@app.command(short_help="Describe details of a specific email."
|
216
|
+
@app.command(short_help="Describe details of a specific email.")
|
217
217
|
def describe(
|
218
218
|
ctx: typer.Context,
|
219
219
|
email_id: int = _EMAIL_ID,
|
@@ -264,7 +264,7 @@ def describe(
|
|
264
264
|
writer.write(response)
|
265
265
|
|
266
266
|
|
267
|
-
@app.command(short_help="List all the templates."
|
267
|
+
@app.command(short_help="List all the templates.")
|
268
268
|
def list_templates(
|
269
269
|
ctx: typer.Context,
|
270
270
|
page_size: Optional[int] = _PAGE_SIZE,
|
@@ -320,7 +320,6 @@ def list_templates(
|
|
320
320
|
|
321
321
|
@app.command(
|
322
322
|
short_help="Describe details of a specific template.",
|
323
|
-
options_metavar="describe_template",
|
324
323
|
)
|
325
324
|
def describe_template(
|
326
325
|
ctx: typer.Context,
|
peak/cli/resources/artifacts.py
CHANGED
@@ -45,7 +45,7 @@ _DOWNLOAD_VERSION = typer.Option(
|
|
45
45
|
_DELETE_VERSION = typer.Argument(..., help="Artifact version number to delete.")
|
46
46
|
|
47
47
|
|
48
|
-
@app.command("list", short_help="List artifacts."
|
48
|
+
@app.command("list", short_help="List artifacts.")
|
49
49
|
def list_artifacts(
|
50
50
|
ctx: typer.Context,
|
51
51
|
page_size: Optional[int] = args.PAGE_SIZE,
|
@@ -83,7 +83,7 @@ def list_artifacts(
|
|
83
83
|
writer.write(response)
|
84
84
|
|
85
85
|
|
86
|
-
@app.command(short_help="Describe an artifact."
|
86
|
+
@app.command(short_help="Describe an artifact.")
|
87
87
|
def describe(
|
88
88
|
ctx: typer.Context,
|
89
89
|
artifact_id: str = _ARTIFACT_ID,
|
@@ -129,7 +129,7 @@ def describe(
|
|
129
129
|
writer.write(response)
|
130
130
|
|
131
131
|
|
132
|
-
@app.command(short_help="Delete an artifact."
|
132
|
+
@app.command(short_help="Delete an artifact.")
|
133
133
|
def delete(
|
134
134
|
ctx: typer.Context,
|
135
135
|
artifact_id: str = _ARTIFACT_ID,
|
@@ -158,10 +158,10 @@ def delete(
|
|
158
158
|
|
159
159
|
with writer.pager():
|
160
160
|
response = artifact_client.delete_artifact(artifact_id=artifact_id)
|
161
|
-
writer.write(response)
|
161
|
+
writer.write(response, output_type=OutputTypes.json)
|
162
162
|
|
163
163
|
|
164
|
-
@app.command(short_help="Create a new artifact."
|
164
|
+
@app.command(short_help="Create a new artifact.")
|
165
165
|
def create(
|
166
166
|
ctx: typer.Context,
|
167
167
|
file: str = args.TEMPLATE_PATH,
|
@@ -211,7 +211,7 @@ def create(
|
|
211
211
|
writer.write(response)
|
212
212
|
|
213
213
|
|
214
|
-
@app.command(short_help="Update an artifact's metadata."
|
214
|
+
@app.command(short_help="Update an artifact's metadata.")
|
215
215
|
def update_metadata(
|
216
216
|
ctx: typer.Context,
|
217
217
|
artifact_id: str = _ARTIFACT_ID,
|
@@ -256,7 +256,7 @@ def update_metadata(
|
|
256
256
|
writer.write(response)
|
257
257
|
|
258
258
|
|
259
|
-
@app.command(short_help="Download an artifact."
|
259
|
+
@app.command(short_help="Download an artifact.")
|
260
260
|
def download(
|
261
261
|
ctx: typer.Context,
|
262
262
|
artifact_id: str = _ARTIFACT_ID,
|
@@ -288,7 +288,7 @@ def download(
|
|
288
288
|
artifact_client.download_artifact(artifact_id=artifact_id, download_path=download_path, version=version)
|
289
289
|
|
290
290
|
|
291
|
-
@app.command(short_help="Create a new version of the artifact."
|
291
|
+
@app.command(short_help="Create a new version of the artifact.")
|
292
292
|
def create_version(
|
293
293
|
ctx: typer.Context,
|
294
294
|
artifact_id: str = _ARTIFACT_ID,
|
@@ -337,7 +337,7 @@ def create_version(
|
|
337
337
|
writer.write(response)
|
338
338
|
|
339
339
|
|
340
|
-
@app.command(short_help="Delete a version of an artifact."
|
340
|
+
@app.command(short_help="Delete a version of an artifact.")
|
341
341
|
def delete_version(
|
342
342
|
ctx: typer.Context,
|
343
343
|
artifact_id: str = _ARTIFACT_ID,
|
peak/cli/resources/images.py
CHANGED
@@ -41,7 +41,10 @@ _BUILD_ID = typer.Option(..., help="ID of the image build to be used in this ope
|
|
41
41
|
|
42
42
|
_COUNT = typer.Option(None, help="Number of builds required.")
|
43
43
|
|
44
|
-
_BUILD_STATUS = typer.Option(
|
44
|
+
_BUILD_STATUS = typer.Option(
|
45
|
+
None,
|
46
|
+
help="List of build status to filter image builds. Valid values are `building`, `failed`, `success`, `stopped`, `stopping`.",
|
47
|
+
)
|
45
48
|
|
46
49
|
_VERSIONS = typer.Option(None, help="List of version ids to filter image builds.")
|
47
50
|
|
@@ -52,7 +55,10 @@ _IMAGE_LIST_STATUS = typer.Option(
|
|
52
55
|
help="List of status of the latest version to filter the images by. Valid values are `not-ready`, `ready`, `in-use`, `deleting`, `delete-failed`.",
|
53
56
|
)
|
54
57
|
|
55
|
-
_IMAGE_LIST_SCOPE = typer.Option(
|
58
|
+
_IMAGE_LIST_SCOPE = typer.Option(
|
59
|
+
None,
|
60
|
+
help="List of type of image to filter the images by. Valid values are `custom` and `global`.",
|
61
|
+
)
|
56
62
|
|
57
63
|
_IMAGE_LIST_BUILD_STATUS = typer.Option(
|
58
64
|
None,
|
@@ -79,7 +85,10 @@ _NAME = typer.Option(None, help="Name of the image.")
|
|
79
85
|
|
80
86
|
_VERSION = typer.Option(None, help="A valid semantic image version.")
|
81
87
|
|
82
|
-
_TYPE = typer.Option(
|
88
|
+
_TYPE = typer.Option(
|
89
|
+
None,
|
90
|
+
help="Type of the image. Allowed values are 'workflow', 'workspace-r', 'workspace-python, 'api', 'webapp'.",
|
91
|
+
)
|
83
92
|
|
84
93
|
_DESCRIPTION = typer.Option(None, help="Description of the image.")
|
85
94
|
|
@@ -89,7 +98,10 @@ _ARTIFACT_IGNORE_FILES = typer.Option(None, help="Ignore files to use when creat
|
|
89
98
|
|
90
99
|
_BUILD_DETAILS = typer.Option(None, help="Build details of the image. To be passed in stringified json format.")
|
91
100
|
|
92
|
-
_SOURCE = typer.Option(
|
101
|
+
_SOURCE = typer.Option(
|
102
|
+
None,
|
103
|
+
help="The source via which the image is to be created. Allowed values are 'github', 'dockerfile' and 'upload'.",
|
104
|
+
)
|
93
105
|
|
94
106
|
_DOCKERFILE = typer.Option(None, help="The dockerfile to be used to create the image.")
|
95
107
|
|
@@ -125,7 +137,7 @@ MAPPING = {
|
|
125
137
|
}
|
126
138
|
|
127
139
|
|
128
|
-
@app.command(short_help="Create a new image."
|
140
|
+
@app.command(short_help="Create a new image.")
|
129
141
|
def create(
|
130
142
|
ctx: typer.Context,
|
131
143
|
file: Annotated[
|
@@ -167,7 +179,7 @@ def create(
|
|
167
179
|
body (map):
|
168
180
|
name (str): Name of the image.
|
169
181
|
version (str | required: false): A valid semantic image version. If not provided, the version will be set to 0.0.1.
|
170
|
-
type (str): Type of the image.
|
182
|
+
type (str): Type of the image. Allowed values are 'workflow', 'workspace-r', 'workspace-python, 'api' and 'webapp'.
|
171
183
|
description (str | required: false): Description of the image.
|
172
184
|
buildDetails (map | required: false):
|
173
185
|
source (str | required: false): The source via which the image is to be created. Allowed values are 'github', 'dockerfile' and 'upload'. It is 'upload' by default.
|
@@ -255,7 +267,7 @@ def create(
|
|
255
267
|
writer.write(response)
|
256
268
|
|
257
269
|
|
258
|
-
@app.command(short_help="Create a new image version."
|
270
|
+
@app.command(short_help="Create a new image version.")
|
259
271
|
def create_version(
|
260
272
|
ctx: typer.Context,
|
261
273
|
image_id: int = _IMAGE_ID,
|
@@ -388,7 +400,6 @@ def create_version(
|
|
388
400
|
|
389
401
|
@app.command(
|
390
402
|
short_help="Create a new image/version or Update and existing version.",
|
391
|
-
options_metavar="create_or_update_image",
|
392
403
|
)
|
393
404
|
def create_or_update(
|
394
405
|
ctx: typer.Context,
|
@@ -429,7 +440,7 @@ def create_or_update(
|
|
429
440
|
body (map):
|
430
441
|
name (str): Name of the image.
|
431
442
|
version (str | required: false): A valid semantic image version. If not provided, the next patch version of the latest version will be used.
|
432
|
-
type (str): Type of the image.
|
443
|
+
type (str): Type of the image. Allowed values are 'workflow', 'workspace-r', 'workspace-python, 'api' and 'webapp'.
|
433
444
|
description (str | required: false): Description of the image.
|
434
445
|
buildDetails (map | required: false): If not provided and if the image version already exists, the build details of the existing version will be used.
|
435
446
|
source (str | required: false): The source via which the image is to be created. Allowed values are 'github', 'dockerfile' and 'upload'. It is 'upload' by default if new version is being created otherwise the existing version's source will be used.
|
@@ -518,7 +529,7 @@ def create_or_update(
|
|
518
529
|
writer.write(response)
|
519
530
|
|
520
531
|
|
521
|
-
@app.command("list", short_help="List images."
|
532
|
+
@app.command("list", short_help="List images.")
|
522
533
|
def list_images(
|
523
534
|
ctx: typer.Context,
|
524
535
|
page_size: Optional[int] = args.PAGE_SIZE,
|
@@ -571,7 +582,7 @@ def list_images(
|
|
571
582
|
writer.write(response)
|
572
583
|
|
573
584
|
|
574
|
-
@app.command("list-versions", short_help="List image versions."
|
585
|
+
@app.command("list-versions", short_help="List image versions.")
|
575
586
|
def list_image_versions(
|
576
587
|
ctx: typer.Context,
|
577
588
|
image_id: int = _IMAGE_ID,
|
@@ -624,7 +635,7 @@ def list_image_versions(
|
|
624
635
|
writer.write(response)
|
625
636
|
|
626
637
|
|
627
|
-
@app.command(short_help="Describe details of a specific image."
|
638
|
+
@app.command(short_help="Describe details of a specific image.")
|
628
639
|
def describe(
|
629
640
|
ctx: typer.Context,
|
630
641
|
image_id: int = _IMAGE_ID,
|
@@ -663,7 +674,7 @@ def describe(
|
|
663
674
|
writer.write(response)
|
664
675
|
|
665
676
|
|
666
|
-
@app.command(short_help="Describe details of a specific version."
|
677
|
+
@app.command(short_help="Describe details of a specific version.")
|
667
678
|
def describe_version(
|
668
679
|
ctx: typer.Context,
|
669
680
|
image_id: int = args.IMAGE_ID,
|
@@ -711,7 +722,7 @@ def describe_version(
|
|
711
722
|
writer.write(response)
|
712
723
|
|
713
724
|
|
714
|
-
@app.command(short_help="Update an image version."
|
725
|
+
@app.command(short_help="Update an image version.")
|
715
726
|
def update_version(
|
716
727
|
ctx: typer.Context,
|
717
728
|
image_id: int = args.IMAGE_ID,
|
@@ -845,7 +856,7 @@ def update_version(
|
|
845
856
|
writer.write(response)
|
846
857
|
|
847
858
|
|
848
|
-
@app.command(short_help="Delete an image."
|
859
|
+
@app.command(short_help="Delete an image.")
|
849
860
|
def delete(
|
850
861
|
ctx: typer.Context,
|
851
862
|
image_id: int = _IMAGE_ID,
|
@@ -877,7 +888,7 @@ def delete(
|
|
877
888
|
writer.write(response)
|
878
889
|
|
879
890
|
|
880
|
-
@app.command(short_help="Delete an image version."
|
891
|
+
@app.command(short_help="Delete an image version.")
|
881
892
|
def delete_version(
|
882
893
|
ctx: typer.Context,
|
883
894
|
image_id: int = args.IMAGE_ID,
|
@@ -910,7 +921,7 @@ def delete_version(
|
|
910
921
|
writer.write(response)
|
911
922
|
|
912
923
|
|
913
|
-
@app.command(short_help="Delete all the specified versions."
|
924
|
+
@app.command(short_help="Delete all the specified versions.")
|
914
925
|
def delete_versions(
|
915
926
|
ctx: typer.Context,
|
916
927
|
image_id: int = args.IMAGE_ID,
|
@@ -947,7 +958,7 @@ def delete_versions(
|
|
947
958
|
writer.write(response)
|
948
959
|
|
949
960
|
|
950
|
-
@app.command(short_help="List image builds."
|
961
|
+
@app.command(short_help="List image builds.")
|
951
962
|
def list_builds(
|
952
963
|
ctx: typer.Context,
|
953
964
|
image_id: int = _IMAGE_ID,
|