|
22 | 22 | import pytest |
23 | 23 | from ibm_code_engine_sdk.code_engine_v2 import * |
24 | 24 |
|
25 | | -version = '2025-03-29' |
| 25 | +version = '2025-08-27' |
26 | 26 |
|
27 | 27 | # |
28 | 28 | # This file provides an example of how to use the Code Engine service. |
@@ -1333,6 +1333,80 @@ def test_replace_secret_example(self): |
1333 | 1333 | except ApiException as e: |
1334 | 1334 | pytest.fail(str(e)) |
1335 | 1335 |
|
| 1336 | + @needscredentials |
| 1337 | + def test_list_persistent_data_store_example(self): |
| 1338 | + """ |
| 1339 | + list_persistent_data_store request example |
| 1340 | + """ |
| 1341 | + try: |
| 1342 | + print('\nlist_persistent_data_store() result:') |
| 1343 | + |
| 1344 | + # begin-list_persistent_data_store |
| 1345 | + |
| 1346 | + all_results = [] |
| 1347 | + pager = PersistentDataStorePager( |
| 1348 | + client=code_engine_service, |
| 1349 | + project_id='15314cc3-85b4-4338-903f-c28cdee6d005', |
| 1350 | + limit=100, |
| 1351 | + ) |
| 1352 | + while pager.has_next(): |
| 1353 | + next_page = pager.get_next() |
| 1354 | + assert next_page is not None |
| 1355 | + all_results.extend(next_page) |
| 1356 | + |
| 1357 | + print(json.dumps(all_results, indent=2)) |
| 1358 | + |
| 1359 | + # end-list_persistent_data_store |
| 1360 | + except ApiException as e: |
| 1361 | + pytest.fail(str(e)) |
| 1362 | + |
| 1363 | + @needscredentials |
| 1364 | + def test_create_persistent_data_store_example(self): |
| 1365 | + """ |
| 1366 | + create_persistent_data_store request example |
| 1367 | + """ |
| 1368 | + try: |
| 1369 | + print('\ncreate_persistent_data_store() result:') |
| 1370 | + |
| 1371 | + # begin-create_persistent_data_store |
| 1372 | + |
| 1373 | + response = code_engine_service.create_persistent_data_store( |
| 1374 | + project_id='15314cc3-85b4-4338-903f-c28cdee6d005', |
| 1375 | + name='my-persistent-data-store', |
| 1376 | + storage_type='object_storage', |
| 1377 | + ) |
| 1378 | + persistent_data_store = response.get_result() |
| 1379 | + |
| 1380 | + print(json.dumps(persistent_data_store, indent=2)) |
| 1381 | + |
| 1382 | + # end-create_persistent_data_store |
| 1383 | + |
| 1384 | + except ApiException as e: |
| 1385 | + pytest.fail(str(e)) |
| 1386 | + |
| 1387 | + @needscredentials |
| 1388 | + def test_get_persistent_data_store_example(self): |
| 1389 | + """ |
| 1390 | + get_persistent_data_store request example |
| 1391 | + """ |
| 1392 | + try: |
| 1393 | + print('\nget_persistent_data_store() result:') |
| 1394 | + |
| 1395 | + # begin-get_persistent_data_store |
| 1396 | + |
| 1397 | + response = code_engine_service.get_persistent_data_store( |
| 1398 | + project_id='15314cc3-85b4-4338-903f-c28cdee6d005', |
| 1399 | + name='my-persistent-data-store', |
| 1400 | + ) |
| 1401 | + persistent_data_store = response.get_result() |
| 1402 | + |
| 1403 | + print(json.dumps(persistent_data_store, indent=2)) |
| 1404 | + |
| 1405 | + # end-get_persistent_data_store |
| 1406 | + |
| 1407 | + except ApiException as e: |
| 1408 | + pytest.fail(str(e)) |
| 1409 | + |
1336 | 1410 | @needscredentials |
1337 | 1411 | def test_delete_project_example(self): |
1338 | 1412 | """ |
@@ -1580,6 +1654,25 @@ def test_delete_secret_example(self): |
1580 | 1654 | except ApiException as e: |
1581 | 1655 | pytest.fail(str(e)) |
1582 | 1656 |
|
| 1657 | + @needscredentials |
| 1658 | + def test_delete_persistent_data_store_example(self): |
| 1659 | + """ |
| 1660 | + delete_persistent_data_store request example |
| 1661 | + """ |
| 1662 | + try: |
| 1663 | + # begin-delete_persistent_data_store |
| 1664 | + |
| 1665 | + response = code_engine_service.delete_persistent_data_store( |
| 1666 | + project_id='15314cc3-85b4-4338-903f-c28cdee6d005', |
| 1667 | + name='my-persistent-data-store', |
| 1668 | + ) |
| 1669 | + |
| 1670 | + # end-delete_persistent_data_store |
| 1671 | + print('\ndelete_persistent_data_store() response status code: ', response.get_status_code()) |
| 1672 | + |
| 1673 | + except ApiException as e: |
| 1674 | + pytest.fail(str(e)) |
| 1675 | + |
1583 | 1676 |
|
1584 | 1677 | # endregion |
1585 | 1678 | ############################################################################## |
|
0 commit comments