Skip to content

Commit

Permalink
refactor: test notebook and change md
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentLvr committed Jul 2, 2024
1 parent e88d868 commit eee6a8f
Show file tree
Hide file tree
Showing 8 changed files with 497 additions and 329 deletions.
29 changes: 15 additions & 14 deletions Naas API/Naas_API_Create_Storage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"id": "b3ed8dac",
"metadata": {},
"source": [
"**Description:** This notebook demonstrates how to create a Workspace Storage. A Workspace storage is the root of your data directory to set access permission."
"**Description:** This notebook demonstrates how to create a workspace storage. A Workspace storage is the root of your data directory to set access permission."
]
},
{
Expand All @@ -86,7 +86,7 @@
}
},
"source": [
"### Import library"
"### Import libraries"
]
},
{
Expand Down Expand Up @@ -132,7 +132,7 @@
"source": [
"# Required\n",
"\n",
"workspace_id = \"f7a7e3a4-6435-48bc-8da3-88d46161c2b8\"\n",
"workspace_id = \"39e3601a-6f8e-412e-9bd7-1ae772bdc10b\"\n",
"storage_name = \"test\""
]
},
Expand Down Expand Up @@ -179,10 +179,17 @@
"id": "0de0bf16",
"metadata": {},
"source": [
"### Display Result\n",
"```json\n",
"{'error': {'error': 0, 'message': 'Success'}}\n",
"```"
"### Display result"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a114a720",
"metadata": {},
"outputs": [],
"source": [
"storage.get(\"storage\")"
]
},
{
Expand All @@ -199,12 +206,6 @@
"naas-python storage create -w 81507a26-3644-496c-a379-4c7021434aa0 -s test\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "74502426",
"metadata": {},
"source": []
}
],
"metadata": {
Expand All @@ -223,7 +224,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
90 changes: 76 additions & 14 deletions Naas API/Naas_API_Create_Storage_Object.ipynb

Large diffs are not rendered by default.

63 changes: 50 additions & 13 deletions Naas API/Naas_API_Delete_Storage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "32fa0149",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"ERROR:root:Failed to remove log file \\\\wsl.localhost\\Ubuntu\\home\\florentlvr\\awesome-notebooks\\Naas API\\.logs\\2024-07-02_14-42-13.log: [WinError 32] The process cannot access the file because it is being used by another process: '\\\\\\\\wsl.localhost\\\\Ubuntu\\\\home\\\\florentlvr\\\\awesome-notebooks\\\\Naas API\\\\.logs\\\\2024-07-02_14-42-13.log'\n"
]
}
],
"source": [
"try:\n",
" import naas_python\n",
Expand Down Expand Up @@ -123,7 +131,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "97463fa6-6044-4e69-b4ea-59fc0b243dbd",
"metadata": {
"tags": []
Expand All @@ -132,7 +140,7 @@
"source": [
"# Required\n",
"\n",
"workspace_id = \"f7a7e3a4-6435-48bc-8da3-88d46161c2b8\"\n",
"workspace_id = \"39e3601a-6f8e-412e-9bd7-1ae772bdc10b\"\n",
"storage_name = \"test\""
]
},
Expand All @@ -154,16 +162,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "4856c7a5",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{'error': {'error': 0, 'message': 'Success'}}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"deleted_storage = naas_python.storage.delete_workspace_storage(\n",
"storage = naas_python.storage.delete_workspace_storage(\n",
" workspace_id=workspace_id,\n",
" storage_name=storage_name,\n",
")\n",
"deleted_storage"
"storage"
]
},
{
Expand All @@ -179,10 +198,28 @@
"id": "0de0bf16",
"metadata": {},
"source": [
"### Display Result\n",
"```json\n",
"{'error': {'error': 0, 'message': 'Success'}}\n",
"```"
"### Display result"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "74bc635f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'error': {'error': 0, 'message': 'Success'}}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"storage"
]
},
{
Expand Down Expand Up @@ -217,7 +254,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
22 changes: 14 additions & 8 deletions Naas API/Naas_API_Delete_Storage_Object.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@
"outputs": [],
"source": [
"# Required\n",
"\n",
"workspace_id = \"f7a7e3a4-6435-48bc-8da3-88d46161c2b8\"\n",
"storage_name = \"test-storage\"\n",
"object_name=\"directory-1/Naas_API_Storage.ipynb\""
"object_name = \"directory-1/Naas_API_Storage.ipynb\""
]
},
{
Expand All @@ -161,12 +160,12 @@
"metadata": {},
"outputs": [],
"source": [
"delete_object = naas_python.storage.delete_workspace_storage_object(\n",
"object = naas_python.storage.delete_workspace_storage_object(\n",
" workspace_id=workspace_id,\n",
" storage_name=storage_name,\n",
" object_name=object_name\n",
")\n",
"delete_object"
"object"
]
},
{
Expand All @@ -182,10 +181,17 @@
"id": "0de0bf16",
"metadata": {},
"source": [
"### Display Result\n",
"```json\n",
"{'error': {'error': 0, 'message': 'Success'}}\n",
"```"
"### Display result"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d10f7de5",
"metadata": {},
"outputs": [],
"source": [
"object"
]
},
{
Expand Down
Loading

0 comments on commit eee6a8f

Please sign in to comment.