Storages#
- class saagieapi.storages.Storages(saagie_api)#
Bases:
object
- create(project_id: str, storage_name: str, storage_size: int, storage_description: str | None = None) Dict #
Create a storage
Note
Each optional parameter can be set to change the value of the corresponding field.
- Parameters:
- Returns:
Dict of storage information
- Return type:
Examples
>>> saagieapi.storages.create( ... project_id="860b8dc8-e634-4c98-b2e7-f9ec32ab4771", ... storage_name="storage name", ... storage_size="128 MB", ... storage_description="storage description" ... ) { "createVolume":{ "id":"fdb43a11-ccec-4b10-9690-2b83fbd7eb93", "name":"storage name", "size":"128 MB", "description":"storage description", "creationDate":"2022-09-12T13:52:19.523Z", "creator":"user.name", "linkedApp":"None", "originalVolumeId":"None", "duplicationStatus":"None", "isLocked":false } }
- delete(storage_id: str, project_id: str) Dict #
Delete a given storage (not currently used)
- Parameters:
- Returns:
Dict of deleted storage
- Return type:
- Raises:
ValueError – When the storage is currently used
Examples
>>> saagieapi.storages.delete( ... storage_id="fdb43a11-ccec-4b10-9690-2b83fbd7eb93", ... project_id="860b8dc8-e634-4c98-b2e7-f9ec32ab4771" ... ) { "deleteVolume":{ "id":"fdb43a11-ccec-4b10-9690-2b83fbd7eb93", "name":"storage new name", } }
- duplicate(storage_id: str)#
Duplicate a storage
- Parameters:
storage_id (str) – UUID of your storage (see README on how to find it)
- Returns:
Dict of the duplicated storage with its new id
- Return type:
Examples
>>> saagie_api.storages.duplicate(storage_id='fdb43a11-ccec-4b10-9690-2b83fbd7eb93') { 'duplicateVolume': { id: '29cf1b80-6b9c-47bc-a06c-c20897257097', name: 'storage name (copy)', originalVolumeId: 'fdb43a11-ccec-4b10-9690-2b83fbd7eb93', isLocked: true, } }
- edit(storage_id: str, storage_name: str = None, description: str = None) Dict #
Edit a storage
Note
Each optional parameter can be set to change the value of the corresponding field.
- Parameters:
storage_id (str) – UUID of your storage
storage_name (str, optional) – Storage name If not filled, defaults to current value, else it will change the storage’s name
description (str, optional) – Description of storage if not filled, defaults to current value, else it will change the description of the storage
- Returns:
Dict of storage information
- Return type:
Examples
>>> saagieapi.storages.edit( ... storage_id="fdb43a11-ccec-4b10-9690-2b83fbd7eb93", ... storage_name="storage new name", ... storage_description="storage new description" ... ) { "editVolume":{ "id":"fdb43a11-ccec-4b10-9690-2b83fbd7eb93", "name":"storage new name", } }
- get(storage_id: str) Dict #
Get storage information.
Note
You can only get storage information if you have at least the viewer role on the project.
- Parameters:
storage_id (str) – UUID of your storage
- Returns:
Dict of storage information
- Return type:
Examples
>>> saagieapi.storages.get( ... storage_id="f5fce22d-2152-4a01-8c6a-4c2eb4808b6d" ... ) { "volume": { "id":"89bf5f86-3fc3-4bf6-879b-7ca8eafe6c4f", "name":"storage Jupyter Notebook (0)", "size":"64 MB", "description":"Autogenerated storage from app installation for "/notebooks-dir" path in "Jupyter Notebook" app.", "creationDate":"2022-08-26T13:12:05.363Z", "creator":"user.name", "linkedApp":{ "id":"6871e9a2-2c06-45fe-bf8d-6356090f1d1d", "name":"Jupyter Notebook", "versions":[ { "number":1, "volumesWithPath":[ { "path":"/notebooks-dir", "volume":{ "id":"89bf5f86-3fc3-4bf6-879b-7ca8eafe6c4f" } } ] } ], "currentVersion":{ "number":1, "volumesWithPath":[] } }, "originalVolumeId":"None", "duplicationStatus":"None", "isLocked":false } }
- get_info(project_id: str, storage_id: str) Dict #
Get storage information.
Note
You can only get storage information if you have at least the viewer role on the project.
- Parameters:
- Returns:
Dict of storage information
- Return type:
Examples
>>> saagieapi.storages.get_info( ... project_id="860b8dc8-e634-4c98-b2e7-f9ec32ab4771", ... storage_id="f5fce22d-2152-4a01-8c6a-4c2eb4808b6d" ... ) { "id":"89bf5f86-3fc3-4bf6-879b-7ca8eafe6c4f", "name":"storage Jupyter Notebook (0)", "size":"64 MB", "description":"Autogenerated storage from app installation for "/notebooks-dir" path in "Jupyter Notebook" app.", "creationDate":"2022-08-26T13:12:05.363Z", "creator":"user.name", "linkedApp":{ "id":"6871e9a2-2c06-45fe-bf8d-6356090f1d1d", "name":"Jupyter Notebook", "versions":[ { "number":1, "volumesWithPath":[ { "path":"/notebooks-dir", "volume":{ "id":"89bf5f86-3fc3-4bf6-879b-7ca8eafe6c4f" } } ] } ], "currentVersion":{ "number":1, "volumesWithPath":[] } }, "originalVolumeId":"None", "duplicationStatus":"None", "isLocked":false }
Deprecated since version 2.10.0: This function is deprecated and will be removed in a future version. Please use
get()
instead.
- list_for_project(project_id: str, minimal: bool | None = False, pprint_result: bool | None = None) Dict #
List storages of project.
Note
You can only list storage if you have at least the viewer role on the project.
- Parameters:
- Returns:
Dict of storage information
- Return type:
Examples
>>> saagieapi.storages.list_for_project( ... project_id="860b8dc8-e634-4c98-b2e7-f9ec32ab4771", ... minimal=False ... ) { "volumes":[ { "id":"89bf5f86-3fc3-4bf6-879b-7ca8eafe6c4f", "name":"storage Jupyter Notebook (0)", "size":"64 MB", "description":"Autogenerated storage from app installation for "/notebooks-dir" path in "Jupyter Notebook" app.", "creationDate":"2022-08-26T13:12:05.363Z", "creator":"guillaume.prevost", "linkedApp":{ "id":"6871e9a2-2c06-45fe-bf8d-6356090f1d1d", "name":"Jupyter Notebook", "versions":[ { "number":1, "volumesWithPath":[ { "path":"/notebooks-dir", "volume":{ "id":"89bf5f86-3fc3-4bf6-879b-7ca8eafe6c4f" } } ] } ], "currentVersion":{ "number":1, "volumesWithPath":[] } }, "originalVolumeId":"None", "duplicationStatus":"None", "isLocked":false }, { "id":"905d8441-8955-444f-a333-19d7c6fe6274", "name":"test", "size":"128 MB", "description":"test description", "creationDate":"2022-08-29T08:02:11.811Z", "creator":"user.name", "linkedApp":{ "id":"c7b2b5ea-834a-4e0e-bfa4-f3303477b9e5", "name":"test_app", "versions":[ { "number":5, "volumesWithPath":[ { "path":"/data", "volume":{ "id":"905d8441-8955-444f-a333-19d7c6fe6274" } } ] } ], "currentVersion":{ "number":1, "volumesWithPath":[ { "path":"/data", "volume":{ "id":"905d8441-8955-444f-a333-19d7c6fe6274" } } ] } }, "originalVolumeId":"None", "duplicationStatus":"None", "isLocked":false } ] }
- move(storage_id: str, target_platform_id: int, target_project_id: str)#
Move a storage to another project in the same platform or another one
- Parameters:
- Returns:
Dict of the moved storage with its new id
- Return type:
Examples
>>> saagie_api.storages.move(storage_id=storage_id, target_platform_id=1, target_project_id=project_id) { 'moveVolume': '29cf1b80-6b9c-47bc-a06c-c20897257097', }
- unlink(storage_id: str, project_id: str) Dict #
Unlink a given storage (not currently used) to the associated app
- Parameters:
- Returns:
Dict of unlink storage
- Return type:
- Raises:
ValueError – When the storage is currently used
Examples
>>> saagieapi.storages.unlink( ... storage_id="fdb43a11-ccec-4b10-9690-2b83fbd7eb93", ... project_id="860b8dc8-e634-4c98-b2e7-f9ec32ab4771" ... ) { "unlinkVolume":{ "id":"fdb43a11-ccec-4b10-9690-2b83fbd7eb93", "name":"storage new name", } }