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.
Files changed (57) hide show
  1. peak/_metadata.py +78 -58
  2. peak/_version.py +1 -1
  3. peak/callbacks.py +22 -2
  4. peak/cli/args.py +19 -0
  5. peak/cli/helpers.py +12 -8
  6. peak/cli/press/apps/deployments.py +72 -18
  7. peak/cli/press/apps/specs.py +29 -11
  8. peak/cli/press/blocks/deployments.py +71 -18
  9. peak/cli/press/blocks/specs.py +95 -35
  10. peak/cli/press/deployments.py +40 -1
  11. peak/cli/press/specs.py +2 -2
  12. peak/cli/resources/alerts/emails.py +4 -5
  13. peak/cli/resources/artifacts.py +9 -9
  14. peak/cli/resources/images.py +29 -18
  15. peak/cli/resources/services.py +6 -7
  16. peak/cli/resources/tenants.py +4 -2
  17. peak/cli/resources/users.py +3 -3
  18. peak/cli/resources/webapps.py +6 -6
  19. peak/cli/resources/workflows.py +24 -25
  20. peak/compression.py +28 -13
  21. peak/exceptions.py +15 -1
  22. peak/handler.py +5 -1
  23. peak/helpers.py +38 -0
  24. peak/output.py +13 -6
  25. peak/press/apps.py +43 -3
  26. peak/press/blocks.py +450 -138
  27. peak/press/deployments.py +25 -0
  28. peak/resources/images.py +309 -86
  29. peak/sample_yaml/press/apps/specs/create_app_spec.yaml +2 -0
  30. peak/sample_yaml/press/apps/specs/create_app_spec_release.yaml +2 -0
  31. peak/sample_yaml/press/blocks/specs/service/api/create_block_spec.yaml +102 -0
  32. peak/sample_yaml/press/blocks/specs/service/api/create_block_spec_release.yaml +88 -0
  33. peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec.yaml +103 -0
  34. peak/sample_yaml/press/blocks/specs/service/webapp/create_block_spec_release.yaml +89 -0
  35. peak/sample_yaml/press/blocks/specs/{create_block_spec.yaml → workflow/create_block_spec.yaml} +20 -1
  36. peak/sample_yaml/press/blocks/specs/{create_block_spec_release.yaml → workflow/create_block_spec_release.yaml} +20 -1
  37. peak/sample_yaml/resources/images/dockerfile/create_image.yaml +3 -0
  38. peak/sample_yaml/resources/images/dockerfile/create_image_version.yaml +3 -0
  39. peak/sample_yaml/resources/images/dockerfile/update_version.yaml +3 -0
  40. peak/sample_yaml/resources/images/github/create_image.yaml +3 -0
  41. peak/sample_yaml/resources/images/github/create_image_version.yaml +3 -0
  42. peak/sample_yaml/resources/images/github/update_version.yaml +3 -0
  43. peak/sample_yaml/resources/images/upload/create_image.yaml +3 -0
  44. peak/sample_yaml/resources/images/upload/create_image_version.yaml +3 -0
  45. peak/sample_yaml/resources/images/upload/create_or_update_image.yaml +3 -0
  46. peak/sample_yaml/resources/images/upload/update_version.yaml +3 -0
  47. peak/sample_yaml/resources/workflows/create_or_update_workflow.yaml +9 -1
  48. peak/sample_yaml/resources/workflows/create_workflow.yaml +9 -1
  49. peak/sample_yaml/resources/workflows/patch_workflow.yaml +9 -1
  50. peak/sample_yaml/resources/workflows/update_workflow.yaml +9 -1
  51. peak/session.py +1 -1
  52. peak/template.py +21 -2
  53. {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/METADATA +18 -18
  54. {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/RECORD +57 -53
  55. {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/LICENSE +0 -0
  56. {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/WHEEL +0 -0
  57. {peak_sdk-1.6.0.dist-info → peak_sdk-1.8.0.dist-info}/entry_points.txt +0 -0
@@ -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 apps deployments commands."""
22
+
22
23
  from __future__ import annotations
23
24
 
24
25
  from typing import Dict, List, Optional
@@ -37,11 +38,12 @@ console = Console()
37
38
  _DEPLOYMENT_ID = typer.Argument(..., help="ID of the App deployment to be used in this operation.")
38
39
 
39
40
 
40
- @app.command(short_help="Create an App deployment.", options_metavar="create_app_deployment")
41
+ @app.command(short_help="Create an App deployment.")
41
42
  def create(
42
43
  ctx: typer.Context,
43
44
  file: str = args.TEMPLATE_PATH,
44
45
  description_file: Optional[str] = args.TEMPLATE_DESCRIPTION_FILE,
46
+ revision_notes_file: Optional[str] = args.REVISION_NOTES_FILE,
45
47
  params_file: Optional[str] = args.TEMPLATE_PARAMS_FILE,
46
48
  params: Optional[List[str]] = args.TEMPLATE_PARAMS,
47
49
  dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
@@ -95,7 +97,13 @@ def create(
95
97
  app_client: App = ctx.obj["client"]
96
98
  writer: Writer = ctx.obj["writer"]
97
99
 
98
- body = helpers.template_handler(file, params_file, params, description_file)
100
+ markdown_files = {}
101
+ if description_file:
102
+ markdown_files["body:metadata:description"] = description_file
103
+ if revision_notes_file:
104
+ markdown_files["body:revision:notes"] = revision_notes_file
105
+
106
+ body = helpers.template_handler(file, params_file, params, markdown_files)
99
107
  body = helpers.remove_unknown_args(body, app_client.create_deployment)
100
108
 
101
109
  with writer.pager():
@@ -103,7 +111,7 @@ def create(
103
111
  writer.write(response)
104
112
 
105
113
 
106
- @app.command("list", short_help="List App deployments.", options_metavar="list_app_deployments")
114
+ @app.command("list", short_help="List App deployments.")
107
115
  def list_app_deployments(
108
116
  ctx: typer.Context,
109
117
  page_size: Optional[int] = args.PAGE_SIZE,
@@ -136,7 +144,7 @@ def list_app_deployments(
136
144
 
137
145
  🔗 [**API Documentation**](https://press.peak.ai/api-docs/index.htm#/App%20Deployments/get_v1_apps_deployments)
138
146
  """
139
- app_client = ctx.obj["client"]
147
+ app_client: App = ctx.obj["client"]
140
148
  writer: Writer = ctx.obj["writer"]
141
149
 
142
150
  with writer.pager():
@@ -151,7 +159,7 @@ def list_app_deployments(
151
159
  writer.write(response)
152
160
 
153
161
 
154
- @app.command(short_help="Describe an App deployment.", options_metavar="describe_app_deployment")
162
+ @app.command(short_help="Describe an App deployment.")
155
163
  def describe(
156
164
  ctx: typer.Context,
157
165
  deployment_id: str = _DEPLOYMENT_ID,
@@ -163,7 +171,7 @@ def describe(
163
171
  \b
164
172
  📝 ***Example usage:***<br/>
165
173
  ```bash
166
- peak apps deployments describe "632a4e7c-ab86-4ecb-8f34-99b5da531ceb"
174
+ peak apps deployments describe <deployment_id>
167
175
  ```
168
176
 
169
177
  \b
@@ -188,7 +196,7 @@ def describe(
188
196
  writer.write(response)
189
197
 
190
198
 
191
- @app.command(short_help="Delete an App deployment.", options_metavar="delete_app_deployment")
199
+ @app.command(short_help="Delete an App deployment.")
192
200
  def delete(
193
201
  ctx: typer.Context,
194
202
  deployment_id: str = _DEPLOYMENT_ID,
@@ -201,7 +209,7 @@ def delete(
201
209
  \b
202
210
  📝 ***Example usage:***<br/>
203
211
  ```bash
204
- peak apps deployments delete "632a4e7c-ab86-4ecb-8f34-99b5da531ceb"
212
+ peak apps deployments delete <deployment_id>
205
213
  ```
206
214
 
207
215
  \b
@@ -212,7 +220,7 @@ def delete(
212
220
 
213
221
  🔗 [**API Documentation**](https://press.peak.ai/api-docs/index.htm#/App%20Deployments/delete_v1_apps_deployments__deploymentId_)
214
222
  """
215
- app_client = ctx.obj["client"]
223
+ app_client: App = ctx.obj["client"]
216
224
  writer: Writer = ctx.obj["writer"]
217
225
 
218
226
  with writer.pager():
@@ -220,7 +228,7 @@ def delete(
220
228
  writer.write(response)
221
229
 
222
230
 
223
- @app.command(short_help="Update the App deployment metadata.", options_metavar="update_app_deployment_metadata")
231
+ @app.command(short_help="Update the App deployment metadata.")
224
232
  def update_metadata(
225
233
  ctx: typer.Context,
226
234
  deployment_id: str = _DEPLOYMENT_ID,
@@ -252,7 +260,7 @@ def update_metadata(
252
260
  \b
253
261
  📝 ***Example usage:***
254
262
  ```bash
255
- peak apps deployments update-metadata "632a4e7c-ab86-4ecb-8f34-99b5da531ceb" /path/to/body.yaml -v /path/to/params.yaml
263
+ peak apps deployments update-metadata <deployment_id> /path/to/body.yaml -v /path/to/params.yaml
256
264
  ```
257
265
 
258
266
  \b
@@ -269,10 +277,14 @@ def update_metadata(
269
277
 
270
278
  🔗 [**API Documentation**](https://press.peak.ai/api-docs/index.htm#/App%20Deployments/patch_v1_apps_deployments__deploymentId_)
271
279
  """
272
- app_client = ctx.obj["client"]
280
+ app_client: App = ctx.obj["client"]
273
281
  writer: Writer = ctx.obj["writer"]
274
282
 
275
- body = helpers.template_handler(file, params_file, params, description_file)
283
+ markdown_files = {}
284
+ if description_file:
285
+ markdown_files["body:description"] = description_file
286
+
287
+ body = helpers.template_handler(file, params_file, params, markdown_files)
276
288
  body = helpers.remove_unknown_args(body, app_client.update_deployment_metadata)
277
289
 
278
290
  with writer.pager():
@@ -280,11 +292,49 @@ def update_metadata(
280
292
  writer.write(response)
281
293
 
282
294
 
283
- @app.command(short_help="Create an App deployment revision.", options_metavar="create_app_deployment_revision")
295
+ @app.command(short_help="Redploy an App deployment.")
296
+ def redeploy(
297
+ ctx: typer.Context,
298
+ deployment_id: str = _DEPLOYMENT_ID,
299
+ dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
300
+ paging: Optional[bool] = PAGING, # noqa: ARG001
301
+ output_type: Optional[OutputTypesNoTable] = OUTPUT_TYPES, # noqa: ARG001
302
+ ) -> None:
303
+ """***Redeploy*** latest revision an App deployment.
304
+
305
+ This allows you to redeploy an App deployment that is in a `failed` or `warning` state, provided at least one of its block deployments is also in a `failed` or `warning` state.
306
+
307
+ \b
308
+ 📝 ***Example usage:***<br/>
309
+ ```bash
310
+ peak apps deployments redeploy <deployment_id>
311
+ ```
312
+
313
+ \b
314
+ 🆗 ***Response:***
315
+ ```json
316
+ {
317
+ "deploymentId": "632a4e7c-ab86-4ecb-8f34-99b5da531ceb",
318
+ "revision": 2
319
+ "revisionId": "7092bd84-c35d-43c1-90ca-7510a1204dcc"
320
+ }
321
+ ```
322
+ 🔗 [**API Documentation**](https://press.peak.ai/api-docs/index.htm#/App%20Deployments/post_v1_apps_deployments__deploymentId__redeploy)
323
+ """
324
+ app_client: App = ctx.obj["client"]
325
+ writer: Writer = ctx.obj["writer"]
326
+
327
+ with writer.pager():
328
+ response = app_client.redeploy(deployment_id)
329
+ writer.write(response)
330
+
331
+
332
+ @app.command(short_help="Create an App deployment revision.")
284
333
  def create_revision(
285
334
  ctx: typer.Context,
286
335
  deployment_id: str = _DEPLOYMENT_ID,
287
336
  file: str = args.TEMPLATE_PATH,
337
+ revision_notes_file: Optional[str] = args.REVISION_NOTES_FILE,
288
338
  params_file: Optional[str] = args.TEMPLATE_PARAMS_FILE,
289
339
  params: Optional[List[str]] = args.TEMPLATE_PARAMS,
290
340
  dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
@@ -329,7 +379,11 @@ def create_revision(
329
379
  app_client: App = ctx.obj["client"]
330
380
  writer: Writer = ctx.obj["writer"]
331
381
 
332
- body = helpers.template_handler(file, params_file, params)
382
+ markdown_files = {}
383
+ if revision_notes_file:
384
+ markdown_files["body:revision:notes"] = revision_notes_file
385
+
386
+ body = helpers.template_handler(file, params_file, params, markdown_files)
333
387
  body = helpers.remove_unknown_args(body, app_client.create_deployment_revision)
334
388
 
335
389
  with writer.pager():
@@ -337,7 +391,7 @@ def create_revision(
337
391
  writer.write(response)
338
392
 
339
393
 
340
- @app.command(short_help="Describe an App deployment revision.", options_metavar="describe_app_deployment_revision")
394
+ @app.command(short_help="Describe an App deployment revision.")
341
395
  def describe_revision(
342
396
  ctx: typer.Context,
343
397
  deployment_id: str = args.DEPLOYMENT_ID,
@@ -354,7 +408,7 @@ def describe_revision(
354
408
  \b
355
409
  📝 ***Example usage:***<br/>
356
410
  ```bash
357
- peak apps deployments describe-revision --deployment-id "632a4e7c-ab86-4ecb-8f34-99b5da531ceb" --revision 2
411
+ peak apps deployments describe-revision --deployment-id <deployment_id> --revision <revision>
358
412
  ```
359
413
 
360
414
  \b
@@ -384,7 +438,7 @@ def describe_revision(
384
438
  writer.write(response)
385
439
 
386
440
 
387
- @app.command(short_help="List revisions of an App deployment.", options_metavar="list_app_deployment_revisions")
441
+ @app.command(short_help="List revisions of an App deployment.")
388
442
  def list_revisions(
389
443
  ctx: typer.Context,
390
444
  deployment_id: str = _DEPLOYMENT_ID,
@@ -35,11 +35,12 @@ console = Console()
35
35
  _SPEC_ID = typer.Argument(..., help="ID of the App spec to be used in this operation.")
36
36
 
37
37
 
38
- @app.command(short_help="Create an App spec.", options_metavar="create_app_spec")
38
+ @app.command(short_help="Create an App spec.")
39
39
  def create(
40
40
  ctx: typer.Context,
41
41
  file: str = args.TEMPLATE_PATH,
42
42
  description_file: Optional[str] = args.TEMPLATE_DESCRIPTION_FILE,
43
+ release_notes_file: Optional[str] = args.RELEASE_NOTES_FILE,
43
44
  params_file: Optional[str] = args.TEMPLATE_PARAMS_FILE,
44
45
  params: Optional[List[str]] = args.TEMPLATE_PARAMS,
45
46
  dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
@@ -74,6 +75,7 @@ def create(
74
75
  - id (string): ID of the block spec.
75
76
  release (map):
76
77
  version (string): A valid semantic release version of the block spec.
78
+ autoRunOnDeploy (bool | required: false): Whether to execute the resource after the app is deployed. By default it is False.
77
79
  ```
78
80
 
79
81
  \b
@@ -95,7 +97,13 @@ def create(
95
97
  app_client: App = ctx.obj["client"]
96
98
  writer: Writer = ctx.obj["writer"]
97
99
 
98
- body = helpers.template_handler(file, params_file, params, description_file)
100
+ markdown_files = {}
101
+ if description_file:
102
+ markdown_files["body:metadata:description"] = description_file
103
+ if release_notes_file:
104
+ markdown_files["body:release:notes"] = release_notes_file
105
+
106
+ body = helpers.template_handler(file, params_file, params, markdown_files)
99
107
  body = helpers.remove_unknown_args(body, app_client.create_spec)
100
108
 
101
109
  with writer.pager():
@@ -103,7 +111,7 @@ def create(
103
111
  writer.write(response)
104
112
 
105
113
 
106
- @app.command("list", short_help="List App specs.", options_metavar="list_app_specs")
114
+ @app.command("list", short_help="List App specs.")
107
115
  def list_app_specs(
108
116
  ctx: typer.Context,
109
117
  page_size: Optional[int] = args.PAGE_SIZE,
@@ -157,7 +165,7 @@ def list_app_specs(
157
165
  writer.write(response)
158
166
 
159
167
 
160
- @app.command(short_help="Describe an App spec.", options_metavar="describe_app_spec")
168
+ @app.command(short_help="Describe an App spec.")
161
169
  def describe(
162
170
  ctx: typer.Context,
163
171
  spec_id: str = _SPEC_ID,
@@ -195,7 +203,7 @@ def describe(
195
203
  writer.write(response)
196
204
 
197
205
 
198
- @app.command(short_help="Update the App spec metadata.", options_metavar="update_app_spec_metadata")
206
+ @app.command(short_help="Update the App spec metadata.")
199
207
  def update_metadata(
200
208
  ctx: typer.Context,
201
209
  spec_id: str = _SPEC_ID,
@@ -253,7 +261,11 @@ def update_metadata(
253
261
  app_client: App = ctx.obj["client"]
254
262
  writer: Writer = ctx.obj["writer"]
255
263
 
256
- data = helpers.template_handler(file, params_file, params, description_file)
264
+ markdown_files = {}
265
+ if description_file:
266
+ markdown_files["body:metadata:description"] = description_file
267
+
268
+ data = helpers.template_handler(file, params_file, params, markdown_files)
257
269
  data = helpers.remove_unknown_args(data, app_client.update_spec_metadata)
258
270
 
259
271
  with writer.pager():
@@ -261,7 +273,7 @@ def update_metadata(
261
273
  writer.write(response)
262
274
 
263
275
 
264
- @app.command(short_help="Delete an App spec.", options_metavar="delete_app_spec")
276
+ @app.command(short_help="Delete an App spec.")
265
277
  def delete(
266
278
  ctx: typer.Context,
267
279
  spec_id: str = _SPEC_ID,
@@ -293,11 +305,12 @@ def delete(
293
305
  writer.write(response)
294
306
 
295
307
 
296
- @app.command(short_help="Create a new release of the App spec.", options_metavar="create_app_spec_release")
308
+ @app.command(short_help="Create a new release of the App spec.")
297
309
  def create_release(
298
310
  ctx: typer.Context,
299
311
  spec_id: str = _SPEC_ID,
300
312
  file: str = args.TEMPLATE_PATH,
313
+ release_notes_file: Optional[str] = args.RELEASE_NOTES_FILE,
301
314
  params_file: Optional[str] = args.TEMPLATE_PARAMS_FILE,
302
315
  params: Optional[List[str]] = args.TEMPLATE_PARAMS,
303
316
  dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
@@ -318,6 +331,7 @@ def create_release(
318
331
  - id (string): ID of the block spec.
319
332
  release (map):
320
333
  version (string): A valid semantic release version of the block spec.
334
+ autoRunOnDeploy (bool | required: false): Whether to execute the resource after the app is deployed. By default it is False.
321
335
  ```
322
336
 
323
337
  \b
@@ -342,7 +356,11 @@ def create_release(
342
356
  app_client: App = ctx.obj["client"]
343
357
  writer: Writer = ctx.obj["writer"]
344
358
 
345
- body = helpers.template_handler(file, params_file, params)
359
+ markdown_files = {}
360
+ if release_notes_file:
361
+ markdown_files["body:release:notes"] = release_notes_file
362
+
363
+ body = helpers.template_handler(file, params_file, params, markdown_files)
346
364
  body = helpers.remove_unknown_args(body, app_client.create_spec_release)
347
365
 
348
366
  with writer.pager():
@@ -350,7 +368,7 @@ def create_release(
350
368
  writer.write(response)
351
369
 
352
370
 
353
- @app.command(short_help="Describe an App spec release.", options_metavar="describe_app_spec_release")
371
+ @app.command(short_help="Describe an App spec release.")
354
372
  def describe_release(
355
373
  ctx: typer.Context,
356
374
  spec_id: str = args.SPEC_ID,
@@ -395,7 +413,7 @@ def describe_release(
395
413
  writer.write(response)
396
414
 
397
415
 
398
- @app.command(short_help="List App specs releases.", options_metavar="list_app_spec_releases")
416
+ @app.command(short_help="List App specs releases.")
399
417
  def list_releases(
400
418
  ctx: typer.Context,
401
419
  spec_id: str = args.SPEC_ID,
@@ -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 deployments commands."""
22
+
22
23
  from __future__ import annotations
23
24
 
24
25
  from typing import Dict, List, Optional
@@ -45,11 +46,12 @@ _FALLBACK_DETAILS_FILE = typer.Option(
45
46
  )
46
47
 
47
48
 
48
- @app.command(short_help="Create a Block deployment.", options_metavar="create_block_deployment")
49
+ @app.command(short_help="Create a Block deployment.")
49
50
  def create(
50
51
  ctx: typer.Context,
51
52
  file: str = args.TEMPLATE_PATH,
52
53
  description_file: Optional[str] = args.TEMPLATE_DESCRIPTION_FILE,
54
+ revision_notes_file: Optional[str] = args.REVISION_NOTES_FILE,
53
55
  params_file: Optional[str] = args.TEMPLATE_PARAMS_FILE,
54
56
  params: Optional[List[str]] = args.TEMPLATE_PARAMS,
55
57
  dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
@@ -102,7 +104,13 @@ def create(
102
104
  blocks_client: Block = ctx.obj["client"]
103
105
  writer: Writer = ctx.obj["writer"]
104
106
 
105
- body = helpers.template_handler(file, params_file, params, description_file)
107
+ markdown_files = {}
108
+ if description_file:
109
+ markdown_files["body:metadata:description"] = description_file
110
+ if revision_notes_file:
111
+ markdown_files["body:revision:notes"] = revision_notes_file
112
+
113
+ body = helpers.template_handler(file, params_file, params, markdown_files)
106
114
  body = helpers.remove_unknown_args(body, blocks_client.create_deployment)
107
115
 
108
116
  with writer.pager():
@@ -110,7 +118,7 @@ def create(
110
118
  writer.write(response)
111
119
 
112
120
 
113
- @app.command("list", short_help="List Block deployments.", options_metavar="list_block_deployments")
121
+ @app.command("list", short_help="List Block deployments.")
114
122
  def list_block_deployments(
115
123
  ctx: typer.Context,
116
124
  page_size: Optional[int] = args.PAGE_SIZE,
@@ -160,7 +168,7 @@ def list_block_deployments(
160
168
  writer.write(response)
161
169
 
162
170
 
163
- @app.command(short_help="Describe the Block deployment.", options_metavar="descibe_block_deployment")
171
+ @app.command(short_help="Describe the Block deployment.")
164
172
  def describe(
165
173
  ctx: typer.Context,
166
174
  deployment_id: str = _DEPLOYMENT_ID,
@@ -176,7 +184,7 @@ def describe(
176
184
  \b
177
185
  📝 ***Example usage:***<br/>
178
186
  ```bash
179
- peak blocks deployments describe "632a4e7c-ab86-4ecb-8f34-99b5da531ceb"
187
+ peak blocks deployments describe <deployment_id>
180
188
  ```
181
189
 
182
190
  \b
@@ -202,7 +210,7 @@ def describe(
202
210
  writer.write(response)
203
211
 
204
212
 
205
- @app.command(short_help="Update the Block deployment metadata.", options_metavar="update_block_deployment_metadata")
213
+ @app.command(short_help="Update the Block deployment metadata.")
206
214
  def update_metadata(
207
215
  ctx: typer.Context,
208
216
  deployment_id: str = _DEPLOYMENT_ID,
@@ -234,7 +242,7 @@ def update_metadata(
234
242
  \b
235
243
  📝 ***Example usage:***
236
244
  ```bash
237
- peak blocks deployments update-metadata "632a4e7c-ab86-4ecb-8f34-99b5da531ceb" /path/to/body.yaml -v /path/to/params.yaml
245
+ peak blocks deployments update-metadata <deployment_id> /path/to/body.yaml -v /path/to/params.yaml
238
246
  ```
239
247
 
240
248
  \b
@@ -254,7 +262,11 @@ def update_metadata(
254
262
  blocks_client: Block = ctx.obj["client"]
255
263
  writer: Writer = ctx.obj["writer"]
256
264
 
257
- body = helpers.template_handler(file, params_file, params, description_file)
265
+ markdown_files = {}
266
+ if description_file:
267
+ markdown_files["body:description"] = description_file
268
+
269
+ body = helpers.template_handler(file, params_file, params, markdown_files)
258
270
  body = helpers.remove_unknown_args(body, blocks_client.update_deployment_metadata)
259
271
 
260
272
  with writer.pager():
@@ -262,7 +274,43 @@ def update_metadata(
262
274
  writer.write(response)
263
275
 
264
276
 
265
- @app.command(short_help="Delete a Block deployment.", options_metavar="delete_block_deployment")
277
+ @app.command(short_help="Redeploy a Block deployment.")
278
+ def redeploy(
279
+ ctx: typer.Context,
280
+ deployment_id: str = _DEPLOYMENT_ID,
281
+ dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
282
+ paging: Optional[bool] = PAGING, # noqa: ARG001
283
+ output_type: Optional[OutputTypesNoTable] = OUTPUT_TYPES, # noqa: ARG001
284
+ ) -> None:
285
+ """***Redeploy*** latest revision of a Block deployment. This allows you to redeploy a Block deployment that is in `failed` or `warning` state.
286
+
287
+ \b
288
+ 📝 ***Example usage:***<br/>
289
+ ```bash
290
+ peak blocks deployments redeploy <deployment_id>
291
+ ```
292
+
293
+ \b
294
+ 🆗 ***Response:***
295
+ ```json
296
+ {
297
+ "deploymentId": "632a4e7c-ab86-4ecb-8f34-99b5da531ceb",
298
+ "revision": 2
299
+ "revisionId": "7092bd84-c35d-43c1-90ca-7510a1204dcc"
300
+ }
301
+ ```
302
+
303
+ 🔗 [**API Documentation**](https://press.peak.ai/api-docs/index.htm#/Block%20Deployments/redeploy_v1_blocks_deployments__deploymentId_)
304
+ """
305
+ blocks_client: Block = ctx.obj["client"]
306
+ writer: Writer = ctx.obj["writer"]
307
+
308
+ with writer.pager():
309
+ response = blocks_client.redeploy(deployment_id)
310
+ writer.write(response)
311
+
312
+
313
+ @app.command(short_help="Delete a Block deployment.")
266
314
  def delete(
267
315
  ctx: typer.Context,
268
316
  deployment_id: str = _DEPLOYMENT_ID,
@@ -275,7 +323,7 @@ def delete(
275
323
  \b
276
324
  📝 ***Example usage:***<br/>
277
325
  ```bash
278
- peak blocks deployments delete "632a4e7c-ab86-4ecb-8f34-99b5da531ceb"
326
+ peak blocks deployments delete <deployment_id>
279
327
  ```
280
328
 
281
329
  \b
@@ -294,11 +342,12 @@ def delete(
294
342
  writer.write(response)
295
343
 
296
344
 
297
- @app.command(short_help="Create a Block deployment revision.", options_metavar="create_block_deployment_revision")
345
+ @app.command(short_help="Create a Block deployment revision.")
298
346
  def create_revision(
299
347
  ctx: typer.Context,
300
348
  deployment_id: str = _DEPLOYMENT_ID,
301
349
  file: str = args.TEMPLATE_PATH,
350
+ revision_notes_file: Optional[str] = args.REVISION_NOTES_FILE,
302
351
  params_file: Optional[str] = args.TEMPLATE_PARAMS_FILE,
303
352
  params: Optional[List[str]] = args.TEMPLATE_PARAMS,
304
353
  dry_run: Optional[bool] = DRY_RUN, # noqa: ARG001
@@ -342,7 +391,11 @@ def create_revision(
342
391
  blocks_client: Block = ctx.obj["client"]
343
392
  writer: Writer = ctx.obj["writer"]
344
393
 
345
- body = helpers.template_handler(file, params_file, params)
394
+ markdown_files = {}
395
+ if revision_notes_file:
396
+ markdown_files["body:revision:notes"] = revision_notes_file
397
+
398
+ body = helpers.template_handler(file, params_file, params, markdown_files)
346
399
  body = helpers.remove_unknown_args(body, blocks_client.create_deployment_revision)
347
400
 
348
401
  with writer.pager():
@@ -350,7 +403,7 @@ def create_revision(
350
403
  writer.write(response)
351
404
 
352
405
 
353
- @app.command(short_help="Describe a Block deployment revision.", options_metavar="describe_block_deployment_revision")
406
+ @app.command(short_help="Describe a Block deployment revision.")
354
407
  def describe_revision(
355
408
  ctx: typer.Context,
356
409
  deployment_id: str = args.DEPLOYMENT_ID,
@@ -367,7 +420,7 @@ def describe_revision(
367
420
  \b
368
421
  📝 ***Example usage:***<br/>
369
422
  ```bash
370
- peak blocks deployments describe-revision --deployment-id "632a4e7c-ab86-4ecb-8f34-99b5da531ceb" --revision 2
423
+ peak blocks deployments describe-revision --deployment-id <deployment_id> --revision 2
371
424
  ```
372
425
 
373
426
  \b
@@ -397,7 +450,7 @@ def describe_revision(
397
450
  writer.write(response)
398
451
 
399
452
 
400
- @app.command(short_help="List revisions of a Block deployment.", options_metavar="list_block_deployment_revisions")
453
+ @app.command(short_help="List revisions of a Block deployment.")
401
454
  def list_revisions(
402
455
  ctx: typer.Context,
403
456
  deployment_id: str = _DEPLOYMENT_ID,
@@ -445,7 +498,7 @@ def list_revisions(
445
498
  writer.write(response)
446
499
 
447
500
 
448
- @app.command(short_help="Get the parameters for a deployment at run time.", options_metavar="get_block_parameters")
501
+ @app.command(short_help="Get the parameters for a deployment at run time.")
449
502
  def get_parameters(
450
503
  ctx: typer.Context,
451
504
  deployment_id: Optional[str] = _DEPLOYMENT_ID_OPTION,
@@ -480,7 +533,7 @@ def get_parameters(
480
533
  writer.write(response)
481
534
 
482
535
 
483
- @app.command(short_help="Update the parameters for a deployment at run time.", options_metavar="patch_block_parameters")
536
+ @app.command(short_help="Update the parameters for a deployment at run time.")
484
537
  def patch_parameters(
485
538
  ctx: typer.Context,
486
539
  deployment_id: str = _DEPLOYMENT_ID,
@@ -525,7 +578,7 @@ def patch_parameters(
525
578
  writer.write(response)
526
579
 
527
580
 
528
- @app.command(short_help="Get the info for related blocks within an app.", options_metavar="get_related_block_details")
581
+ @app.command(short_help="Get the info for related blocks within an app.")
529
582
  def get_related_block_details(
530
583
  ctx: typer.Context,
531
584
  deployment_id: Optional[str] = _DEPLOYMENT_ID_OPTION,