diff --git a/Naas API/Naas_API_Create_Storage.ipynb b/Naas API/Naas_API_Create_Storage.ipynb
index db7da9f346..810091386c 100644
--- a/Naas API/Naas_API_Create_Storage.ipynb
+++ b/Naas API/Naas_API_Create_Storage.ipynb
@@ -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."
]
},
{
@@ -86,7 +86,7 @@
}
},
"source": [
- "### Import library"
+ "### Import libraries"
]
},
{
@@ -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\""
]
},
@@ -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\")"
]
},
{
@@ -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": {
@@ -223,7 +224,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.4"
+ "version": "3.11.5"
}
},
"nbformat": 4,
diff --git a/Naas API/Naas_API_Create_Storage_Object.ipynb b/Naas API/Naas_API_Create_Storage_Object.ipynb
index 17e5f9f3b4..6a5fcfb08e 100644
--- a/Naas API/Naas_API_Create_Storage_Object.ipynb
+++ b/Naas API/Naas_API_Create_Storage_Object.ipynb
@@ -13,7 +13,7 @@
"id": "90cdfd58-d74b-4ec9-aea8-72fe64903f81",
"metadata": {},
"source": [
- "## Naas API - Delete Storage Object\n",
+ "## Naas API - Create Storage Object\n",
"Give Feedback | Bug report"
]
},
@@ -91,7 +91,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 10,
"id": "32fa0149",
"metadata": {},
"outputs": [],
@@ -125,7 +125,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 11,
"id": "97463fa6-6044-4e69-b4ea-59fc0b243dbd",
"metadata": {
"tags": []
@@ -133,11 +133,10 @@
"outputs": [],
"source": [
"# Required\n",
- "\n",
- "workspace_id = \"f7a7e3a4-6435-48bc-8da3-88d46161c2b8\"\n",
+ "workspace_id = \"39e3601a-6f8e-412e-9bd7-1ae772bdc10b\"\n",
"storage_name = \"test\"\n",
- "src_file=\"Naas_API_Storage.ipynb\"\n",
- "dst_file=\"directory-1/Naas_API_Storage.ipynb\""
+ "src_file = \"Naas_API_Create_Storage.ipynb\"\n",
+ "dst_file = \"Naas_API_Create_Storage.ipynb\""
]
},
{
@@ -158,10 +157,66 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 12,
"id": "4856c7a5",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
[07/02/24 15:05:36] ERROR Parameter validation failed: S3StorageProviderAdaptor.py:279\n",
+ " Invalid type for parameter ContentType, value: None, \n",
+ " type: <class 'NoneType'>, valid types: <class 'str'> \n",
+ "
\n"
+ ],
+ "text/plain": [
+ "\u001b[2;36m[07/02/24 15:05:36]\u001b[0m\u001b[2;36m \u001b[0m\u001b[1;31mERROR \u001b[0m Parameter validation failed: \u001b]8;id=474969;file://C:\\Users\\flore\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\secondary\\providers\\S3StorageProviderAdaptor.py\u001b\\\u001b[2mS3StorageProviderAdaptor.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=752932;file://C:\\Users\\flore\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\secondary\\providers\\S3StorageProviderAdaptor.py#279\u001b\\\u001b[2m279\u001b[0m\u001b]8;;\u001b\\\n",
+ "\u001b[2;36m \u001b[0m Invalid type for parameter ContentType, value: \u001b[3;35mNone\u001b[0m, \u001b[2m \u001b[0m\n",
+ "\u001b[2;36m \u001b[0m type: \u001b[1m<\u001b[0m\u001b[1;95mclass\u001b[0m\u001b[39m \u001b[0m\u001b[32m'NoneType'\u001b[0m\u001b[39m>, valid types: \u001b[0m \u001b[2m \u001b[0m\n"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "ERROR:naas_python.domains.storage.adaptors.secondary.providers.S3StorageProviderAdaptor:Parameter validation failed:\n",
+ "Invalid type for parameter ContentType, value: None, type: , valid types: \n"
+ ]
+ },
+ {
+ "ename": "Exception",
+ "evalue": "Parameter validation failed:\nInvalid type for parameter ContentType, value: None, type: , valid types: ",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[1;31mParamValidationError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\secondary\\providers\\S3StorageProviderAdaptor.py:68\u001b[0m, in \u001b[0;36mS3StorageProviderAdaptor.post_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, src_file, dst_file)\u001b[0m\n\u001b[0;32m 67\u001b[0m s3 \u001b[38;5;241m=\u001b[39m boto3\u001b[38;5;241m.\u001b[39mclient(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ms3\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m---> 68\u001b[0m response \u001b[38;5;241m=\u001b[39m s3\u001b[38;5;241m.\u001b[39mupload_file(Filename\u001b[38;5;241m=\u001b[39msrc_file, Bucket\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnaas_bucket, Key\u001b[38;5;241m=\u001b[39mkey, ExtraArgs\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mContentType\u001b[39m\u001b[38;5;124m'\u001b[39m: content_type})\n\u001b[0;32m 69\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\boto3\\s3\\inject.py:145\u001b[0m, in \u001b[0;36mupload_file\u001b[1;34m(self, Filename, Bucket, Key, ExtraArgs, Callback, Config)\u001b[0m\n\u001b[0;32m 144\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m S3Transfer(\u001b[38;5;28mself\u001b[39m, Config) \u001b[38;5;28;01mas\u001b[39;00m transfer:\n\u001b[1;32m--> 145\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m transfer\u001b[38;5;241m.\u001b[39mupload_file(\n\u001b[0;32m 146\u001b[0m filename\u001b[38;5;241m=\u001b[39mFilename,\n\u001b[0;32m 147\u001b[0m bucket\u001b[38;5;241m=\u001b[39mBucket,\n\u001b[0;32m 148\u001b[0m key\u001b[38;5;241m=\u001b[39mKey,\n\u001b[0;32m 149\u001b[0m extra_args\u001b[38;5;241m=\u001b[39mExtraArgs,\n\u001b[0;32m 150\u001b[0m callback\u001b[38;5;241m=\u001b[39mCallback,\n\u001b[0;32m 151\u001b[0m )\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\boto3\\s3\\transfer.py:372\u001b[0m, in \u001b[0;36mS3Transfer.upload_file\u001b[1;34m(self, filename, bucket, key, callback, extra_args)\u001b[0m\n\u001b[0;32m 371\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 372\u001b[0m future\u001b[38;5;241m.\u001b[39mresult()\n\u001b[0;32m 373\u001b[0m \u001b[38;5;66;03m# If a client error was raised, add the backwards compatibility layer\u001b[39;00m\n\u001b[0;32m 374\u001b[0m \u001b[38;5;66;03m# that raises a S3UploadFailedError. These specific errors were only\u001b[39;00m\n\u001b[0;32m 375\u001b[0m \u001b[38;5;66;03m# ever thrown for upload_parts but now can be thrown for any related\u001b[39;00m\n\u001b[0;32m 376\u001b[0m \u001b[38;5;66;03m# client error.\u001b[39;00m\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\s3transfer\\futures.py:103\u001b[0m, in \u001b[0;36mTransferFuture.result\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 99\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 100\u001b[0m \u001b[38;5;66;03m# Usually the result() method blocks until the transfer is done,\u001b[39;00m\n\u001b[0;32m 101\u001b[0m \u001b[38;5;66;03m# however if a KeyboardInterrupt is raised we want want to exit\u001b[39;00m\n\u001b[0;32m 102\u001b[0m \u001b[38;5;66;03m# out of this and propagate the exception.\u001b[39;00m\n\u001b[1;32m--> 103\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_coordinator\u001b[38;5;241m.\u001b[39mresult()\n\u001b[0;32m 104\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyboardInterrupt\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\s3transfer\\futures.py:266\u001b[0m, in \u001b[0;36mTransferCoordinator.result\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 265\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception:\n\u001b[1;32m--> 266\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception\n\u001b[0;32m 267\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_result\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\s3transfer\\tasks.py:139\u001b[0m, in \u001b[0;36mTask.__call__\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 138\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_transfer_coordinator\u001b[38;5;241m.\u001b[39mdone():\n\u001b[1;32m--> 139\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_execute_main(kwargs)\n\u001b[0;32m 140\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\s3transfer\\tasks.py:162\u001b[0m, in \u001b[0;36mTask._execute_main\u001b[1;34m(self, kwargs)\u001b[0m\n\u001b[0;32m 160\u001b[0m logger\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExecuting task \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m with kwargs \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mkwargs_to_display\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m--> 162\u001b[0m return_value \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_main(\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 163\u001b[0m \u001b[38;5;66;03m# If the task is the final task, then set the TransferFuture's\u001b[39;00m\n\u001b[0;32m 164\u001b[0m \u001b[38;5;66;03m# value to the return value from main().\u001b[39;00m\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\s3transfer\\upload.py:764\u001b[0m, in \u001b[0;36mPutObjectTask._main\u001b[1;34m(self, client, fileobj, bucket, key, extra_args)\u001b[0m\n\u001b[0;32m 763\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m fileobj \u001b[38;5;28;01mas\u001b[39;00m body:\n\u001b[1;32m--> 764\u001b[0m client\u001b[38;5;241m.\u001b[39mput_object(Bucket\u001b[38;5;241m=\u001b[39mbucket, Key\u001b[38;5;241m=\u001b[39mkey, Body\u001b[38;5;241m=\u001b[39mbody, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mextra_args)\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\botocore\\client.py:565\u001b[0m, in \u001b[0;36mClientCreator._create_api_method.._api_call\u001b[1;34m(self, *args, **kwargs)\u001b[0m\n\u001b[0;32m 564\u001b[0m \u001b[38;5;66;03m# The \"self\" in this scope is referring to the BaseClient.\u001b[39;00m\n\u001b[1;32m--> 565\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_make_api_call(operation_name, kwargs)\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\botocore\\client.py:974\u001b[0m, in \u001b[0;36mBaseClient._make_api_call\u001b[1;34m(self, operation_name, api_params)\u001b[0m\n\u001b[0;32m 973\u001b[0m request_context[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mendpoint_properties\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m properties\n\u001b[1;32m--> 974\u001b[0m request_dict \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_convert_to_request_dict(\n\u001b[0;32m 975\u001b[0m api_params\u001b[38;5;241m=\u001b[39mapi_params,\n\u001b[0;32m 976\u001b[0m operation_model\u001b[38;5;241m=\u001b[39moperation_model,\n\u001b[0;32m 977\u001b[0m endpoint_url\u001b[38;5;241m=\u001b[39mendpoint_url,\n\u001b[0;32m 978\u001b[0m context\u001b[38;5;241m=\u001b[39mrequest_context,\n\u001b[0;32m 979\u001b[0m headers\u001b[38;5;241m=\u001b[39madditional_headers,\n\u001b[0;32m 980\u001b[0m )\n\u001b[0;32m 981\u001b[0m resolve_checksum_context(request_dict, operation_model, api_params)\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\botocore\\client.py:1048\u001b[0m, in \u001b[0;36mBaseClient._convert_to_request_dict\u001b[1;34m(self, api_params, operation_model, endpoint_url, context, headers, set_user_agent_header)\u001b[0m\n\u001b[0;32m 1039\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_convert_to_request_dict\u001b[39m(\n\u001b[0;32m 1040\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[0;32m 1041\u001b[0m api_params,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1046\u001b[0m set_user_agent_header\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m,\n\u001b[0;32m 1047\u001b[0m ):\n\u001b[1;32m-> 1048\u001b[0m request_dict \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_serializer\u001b[38;5;241m.\u001b[39mserialize_to_request(\n\u001b[0;32m 1049\u001b[0m api_params, operation_model\n\u001b[0;32m 1050\u001b[0m )\n\u001b[0;32m 1051\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_client_config\u001b[38;5;241m.\u001b[39minject_host_prefix:\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\botocore\\validate.py:381\u001b[0m, in \u001b[0;36mParamValidationDecorator.serialize_to_request\u001b[1;34m(self, parameters, operation_model)\u001b[0m\n\u001b[0;32m 380\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m report\u001b[38;5;241m.\u001b[39mhas_errors():\n\u001b[1;32m--> 381\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ParamValidationError(report\u001b[38;5;241m=\u001b[39mreport\u001b[38;5;241m.\u001b[39mgenerate_report())\n\u001b[0;32m 382\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_serializer\u001b[38;5;241m.\u001b[39mserialize_to_request(\n\u001b[0;32m 383\u001b[0m parameters, operation_model\n\u001b[0;32m 384\u001b[0m )\n",
+ "\u001b[1;31mParamValidationError\u001b[0m: Parameter validation failed:\nInvalid type for parameter ContentType, value: None, type: , valid types: ",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[1;31mException\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[1;32mIn[12], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mobject\u001b[39m \u001b[38;5;241m=\u001b[39m naas_python\u001b[38;5;241m.\u001b[39mstorage\u001b[38;5;241m.\u001b[39mpost_workspace_storage_object(\n\u001b[0;32m 2\u001b[0m workspace_id\u001b[38;5;241m=\u001b[39mworkspace_id,\n\u001b[0;32m 3\u001b[0m storage_name\u001b[38;5;241m=\u001b[39mstorage_name,\n\u001b[0;32m 4\u001b[0m src_file\u001b[38;5;241m=\u001b[39msrc_file,\n\u001b[0;32m 5\u001b[0m dst_file\u001b[38;5;241m=\u001b[39mdst_file\n\u001b[0;32m 6\u001b[0m )\n\u001b[0;32m 7\u001b[0m \u001b[38;5;28mobject\u001b[39m\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\primary\\SDKStorageAdaptor.py:77\u001b[0m, in \u001b[0;36mSDKStorageAdaptor.post_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, src_file, dst_file)\u001b[0m\n\u001b[0;32m 70\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mpost_workspace_storage_object\u001b[39m(\u001b[38;5;28mself\u001b[39m,\n\u001b[0;32m 71\u001b[0m workspace_id: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, \n\u001b[0;32m 72\u001b[0m storage_name: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 73\u001b[0m src_file: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 74\u001b[0m dst_file: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 75\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mbytes\u001b[39m:\n\u001b[0;32m 76\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39misfile(src_file):\n\u001b[1;32m---> 77\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdomain\u001b[38;5;241m.\u001b[39mpost_workspace_storage_object(\n\u001b[0;32m 78\u001b[0m workspace_id\u001b[38;5;241m=\u001b[39mworkspace_id,\n\u001b[0;32m 79\u001b[0m storage_name\u001b[38;5;241m=\u001b[39mstorage_name,\n\u001b[0;32m 80\u001b[0m src_file\u001b[38;5;241m=\u001b[39msrc_file,\n\u001b[0;32m 81\u001b[0m dst_file\u001b[38;5;241m=\u001b[39mdst_file,\n\u001b[0;32m 82\u001b[0m )\n\u001b[0;32m 83\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response \n\u001b[0;32m 84\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\StorageDomain.py:117\u001b[0m, in \u001b[0;36mStorageDomain.post_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, src_file, dst_file)\u001b[0m\n\u001b[0;32m 114\u001b[0m credentials \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39madaptor\u001b[38;5;241m.\u001b[39mgenerate_credentials(workspace_id, storage_name)\n\u001b[0;32m 115\u001b[0m storage_provider\u001b[38;5;241m.\u001b[39msave_naas_credentials(workspace_id, storage_name, credentials)\n\u001b[1;32m--> 117\u001b[0m response \u001b[38;5;241m=\u001b[39m storage_provider\u001b[38;5;241m.\u001b[39mpost_workspace_storage_object(workspace_id\u001b[38;5;241m=\u001b[39mworkspace_id, storage_name\u001b[38;5;241m=\u001b[39mstorage_name, src_file\u001b[38;5;241m=\u001b[39msrc_file, dst_file\u001b[38;5;241m=\u001b[39mdst_file)\n\u001b[0;32m 118\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\secondary\\providers\\S3StorageProviderAdaptor.py:71\u001b[0m, in \u001b[0;36mS3StorageProviderAdaptor.post_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, src_file, dst_file)\u001b[0m\n\u001b[0;32m 69\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n\u001b[0;32m 70\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m---> 71\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__handle_exceptions(\u001b[38;5;28mstr\u001b[39m(e))\n\u001b[0;32m 72\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\secondary\\providers\\S3StorageProviderAdaptor.py:280\u001b[0m, in \u001b[0;36mS3StorageProviderAdaptor.__handle_exceptions\u001b[1;34m(self, exception)\u001b[0m\n\u001b[0;32m 278\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m :\n\u001b[0;32m 279\u001b[0m logger\u001b[38;5;241m.\u001b[39merror(exception)\n\u001b[1;32m--> 280\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m(exception)\n",
+ "\u001b[1;31mException\u001b[0m: Parameter validation failed:\nInvalid type for parameter ContentType, value: None, type: , valid types: "
+ ]
+ }
+ ],
"source": [
"object = naas_python.storage.post_workspace_storage_object(\n",
" workspace_id=workspace_id,\n",
@@ -185,10 +240,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": "00846a42",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "object"
]
},
{
@@ -234,7 +296,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.4"
+ "version": "3.11.5"
}
},
"nbformat": 4,
diff --git a/Naas API/Naas_API_Delete_Storage.ipynb b/Naas API/Naas_API_Delete_Storage.ipynb
index c2f5593129..c1326a4187 100644
--- a/Naas API/Naas_API_Delete_Storage.ipynb
+++ b/Naas API/Naas_API_Delete_Storage.ipynb
@@ -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",
@@ -123,7 +131,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"id": "97463fa6-6044-4e69-b4ea-59fc0b243dbd",
"metadata": {
"tags": []
@@ -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\""
]
},
@@ -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"
]
},
{
@@ -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"
]
},
{
@@ -217,7 +254,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.4"
+ "version": "3.11.5"
}
},
"nbformat": 4,
diff --git a/Naas API/Naas_API_Delete_Storage_Object.ipynb b/Naas API/Naas_API_Delete_Storage_Object.ipynb
index b7d859b5c4..4e78dd97c2 100644
--- a/Naas API/Naas_API_Delete_Storage_Object.ipynb
+++ b/Naas API/Naas_API_Delete_Storage_Object.ipynb
@@ -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\""
]
},
{
@@ -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"
]
},
{
@@ -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"
]
},
{
diff --git a/Naas API/Naas_API_Get_Storage_Object.ipynb b/Naas API/Naas_API_Get_Storage_Object.ipynb
index 8c0fe9aa0a..d56f721dd0 100644
--- a/Naas API/Naas_API_Get_Storage_Object.ipynb
+++ b/Naas API/Naas_API_Get_Storage_Object.ipynb
@@ -62,7 +62,7 @@
"id": "b3ed8dac",
"metadata": {},
"source": [
- "**Description:** Download an object from your Naas Storage."
+ "**Description:** This notebook downloads an object from your Naas Storage."
]
},
{
@@ -86,15 +86,23 @@
}
},
"source": [
- "### Import library"
+ "### Import libraries"
]
},
{
"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",
@@ -125,7 +133,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"id": "97463fa6-6044-4e69-b4ea-59fc0b243dbd",
"metadata": {
"tags": []
@@ -133,11 +141,10 @@
"outputs": [],
"source": [
"# Required\n",
- "\n",
- "workspace_id = \"f7a7e3a4-6435-48bc-8da3-88d46161c2b8\"\n",
- "storage_name=\"test-storage\",\n",
- "src_file=\"directory-1/Naas_API_Storage.ipynb\",\n",
- "dst_file=\"local_Naas_API_Storage.ipynb\""
+ "workspace_id = \"39e3601a-6f8e-412e-9bd7-1ae772bdc10b\"\n",
+ "storage_name = \"test\"\n",
+ "src_file = \"Naas_API_Create_Storage.ipynb\"\n",
+ "dst_file = \"Naas_API_Create_Storage.ipynb\""
]
},
{
@@ -158,18 +165,46 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"id": "4856c7a5",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "ename": "FileNotFoundError",
+ "evalue": "[FileNotFoundError]: File not found.",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[1;31mClientError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\secondary\\providers\\S3StorageProviderAdaptor.py:98\u001b[0m, in \u001b[0;36mS3StorageProviderAdaptor.get_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, src_file, dst_file)\u001b[0m\n\u001b[0;32m 97\u001b[0m s3 \u001b[38;5;241m=\u001b[39m boto3\u001b[38;5;241m.\u001b[39mclient(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ms3\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m---> 98\u001b[0m response \u001b[38;5;241m=\u001b[39m s3\u001b[38;5;241m.\u001b[39mdownload_file(Bucket\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnaas_bucket , Key\u001b[38;5;241m=\u001b[39mobject_key, Filename\u001b[38;5;241m=\u001b[39mfilename)\n\u001b[0;32m 99\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\boto3\\s3\\inject.py:192\u001b[0m, in \u001b[0;36mdownload_file\u001b[1;34m(self, Bucket, Key, Filename, ExtraArgs, Callback, Config)\u001b[0m\n\u001b[0;32m 191\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m S3Transfer(\u001b[38;5;28mself\u001b[39m, Config) \u001b[38;5;28;01mas\u001b[39;00m transfer:\n\u001b[1;32m--> 192\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m transfer\u001b[38;5;241m.\u001b[39mdownload_file(\n\u001b[0;32m 193\u001b[0m bucket\u001b[38;5;241m=\u001b[39mBucket,\n\u001b[0;32m 194\u001b[0m key\u001b[38;5;241m=\u001b[39mKey,\n\u001b[0;32m 195\u001b[0m filename\u001b[38;5;241m=\u001b[39mFilename,\n\u001b[0;32m 196\u001b[0m extra_args\u001b[38;5;241m=\u001b[39mExtraArgs,\n\u001b[0;32m 197\u001b[0m callback\u001b[38;5;241m=\u001b[39mCallback,\n\u001b[0;32m 198\u001b[0m )\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\boto3\\s3\\transfer.py:406\u001b[0m, in \u001b[0;36mS3Transfer.download_file\u001b[1;34m(self, bucket, key, filename, extra_args, callback)\u001b[0m\n\u001b[0;32m 405\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 406\u001b[0m future\u001b[38;5;241m.\u001b[39mresult()\n\u001b[0;32m 407\u001b[0m \u001b[38;5;66;03m# This is for backwards compatibility where when retries are\u001b[39;00m\n\u001b[0;32m 408\u001b[0m \u001b[38;5;66;03m# exceeded we need to throw the same error from boto3 instead of\u001b[39;00m\n\u001b[0;32m 409\u001b[0m \u001b[38;5;66;03m# s3transfer's built in RetriesExceededError as current users are\u001b[39;00m\n\u001b[0;32m 410\u001b[0m \u001b[38;5;66;03m# catching the boto3 one instead of the s3transfer exception to do\u001b[39;00m\n\u001b[0;32m 411\u001b[0m \u001b[38;5;66;03m# their own retries.\u001b[39;00m\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\s3transfer\\futures.py:103\u001b[0m, in \u001b[0;36mTransferFuture.result\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 99\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 100\u001b[0m \u001b[38;5;66;03m# Usually the result() method blocks until the transfer is done,\u001b[39;00m\n\u001b[0;32m 101\u001b[0m \u001b[38;5;66;03m# however if a KeyboardInterrupt is raised we want want to exit\u001b[39;00m\n\u001b[0;32m 102\u001b[0m \u001b[38;5;66;03m# out of this and propagate the exception.\u001b[39;00m\n\u001b[1;32m--> 103\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_coordinator\u001b[38;5;241m.\u001b[39mresult()\n\u001b[0;32m 104\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyboardInterrupt\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\s3transfer\\futures.py:266\u001b[0m, in \u001b[0;36mTransferCoordinator.result\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 265\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception:\n\u001b[1;32m--> 266\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception\n\u001b[0;32m 267\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_result\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\s3transfer\\tasks.py:269\u001b[0m, in \u001b[0;36mSubmissionTask._main\u001b[1;34m(self, transfer_future, **kwargs)\u001b[0m\n\u001b[0;32m 267\u001b[0m \u001b[38;5;66;03m# Call the submit method to start submitting tasks to execute the\u001b[39;00m\n\u001b[0;32m 268\u001b[0m \u001b[38;5;66;03m# transfer.\u001b[39;00m\n\u001b[1;32m--> 269\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_submit(transfer_future\u001b[38;5;241m=\u001b[39mtransfer_future, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 270\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m 271\u001b[0m \u001b[38;5;66;03m# If there was an exception raised during the submission of task\u001b[39;00m\n\u001b[0;32m 272\u001b[0m \u001b[38;5;66;03m# there is a chance that the final task that signals if a transfer\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 281\u001b[0m \n\u001b[0;32m 282\u001b[0m \u001b[38;5;66;03m# Set the exception, that caused the process to fail.\u001b[39;00m\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\s3transfer\\download.py:354\u001b[0m, in \u001b[0;36mDownloadSubmissionTask._submit\u001b[1;34m(self, client, config, osutil, request_executor, io_executor, transfer_future, bandwidth_limiter)\u001b[0m\n\u001b[0;32m 351\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m transfer_future\u001b[38;5;241m.\u001b[39mmeta\u001b[38;5;241m.\u001b[39msize \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 352\u001b[0m \u001b[38;5;66;03m# If a size was not provided figure out the size for the\u001b[39;00m\n\u001b[0;32m 353\u001b[0m \u001b[38;5;66;03m# user.\u001b[39;00m\n\u001b[1;32m--> 354\u001b[0m response \u001b[38;5;241m=\u001b[39m client\u001b[38;5;241m.\u001b[39mhead_object(\n\u001b[0;32m 355\u001b[0m Bucket\u001b[38;5;241m=\u001b[39mtransfer_future\u001b[38;5;241m.\u001b[39mmeta\u001b[38;5;241m.\u001b[39mcall_args\u001b[38;5;241m.\u001b[39mbucket,\n\u001b[0;32m 356\u001b[0m Key\u001b[38;5;241m=\u001b[39mtransfer_future\u001b[38;5;241m.\u001b[39mmeta\u001b[38;5;241m.\u001b[39mcall_args\u001b[38;5;241m.\u001b[39mkey,\n\u001b[0;32m 357\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mtransfer_future\u001b[38;5;241m.\u001b[39mmeta\u001b[38;5;241m.\u001b[39mcall_args\u001b[38;5;241m.\u001b[39mextra_args,\n\u001b[0;32m 358\u001b[0m )\n\u001b[0;32m 359\u001b[0m transfer_future\u001b[38;5;241m.\u001b[39mmeta\u001b[38;5;241m.\u001b[39mprovide_transfer_size(\n\u001b[0;32m 360\u001b[0m response[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mContentLength\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[0;32m 361\u001b[0m )\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\botocore\\client.py:565\u001b[0m, in \u001b[0;36mClientCreator._create_api_method.._api_call\u001b[1;34m(self, *args, **kwargs)\u001b[0m\n\u001b[0;32m 564\u001b[0m \u001b[38;5;66;03m# The \"self\" in this scope is referring to the BaseClient.\u001b[39;00m\n\u001b[1;32m--> 565\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_make_api_call(operation_name, kwargs)\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\botocore\\client.py:1021\u001b[0m, in \u001b[0;36mBaseClient._make_api_call\u001b[1;34m(self, operation_name, api_params)\u001b[0m\n\u001b[0;32m 1020\u001b[0m error_class \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mexceptions\u001b[38;5;241m.\u001b[39mfrom_code(error_code)\n\u001b[1;32m-> 1021\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m error_class(parsed_response, operation_name)\n\u001b[0;32m 1022\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
+ "\u001b[1;31mClientError\u001b[0m: An error occurred (404) when calling the HeadObject operation: Not Found",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[1;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[1;32mIn[3], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mobject\u001b[39m \u001b[38;5;241m=\u001b[39m naas_python\u001b[38;5;241m.\u001b[39mstorage\u001b[38;5;241m.\u001b[39mget_workspace_storage_object(\n\u001b[0;32m 2\u001b[0m workspace_id\u001b[38;5;241m=\u001b[39mworkspace_id,\n\u001b[0;32m 3\u001b[0m storage_name\u001b[38;5;241m=\u001b[39mstorage_name,\n\u001b[0;32m 4\u001b[0m src_file\u001b[38;5;241m=\u001b[39msrc_file,\n\u001b[0;32m 5\u001b[0m dst_file\u001b[38;5;241m=\u001b[39mdst_file\n\u001b[0;32m 6\u001b[0m )\n\u001b[0;32m 7\u001b[0m \u001b[38;5;28mobject\u001b[39m\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\primary\\SDKStorageAdaptor.py:94\u001b[0m, in \u001b[0;36mSDKStorageAdaptor.get_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, src_file, dst_file)\u001b[0m\n\u001b[0;32m 87\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mget_workspace_storage_object\u001b[39m(\u001b[38;5;28mself\u001b[39m, \n\u001b[0;32m 88\u001b[0m workspace_id: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, \n\u001b[0;32m 89\u001b[0m storage_name: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 90\u001b[0m src_file: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 91\u001b[0m dst_file: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 92\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mbytes\u001b[39m:\n\u001b[1;32m---> 94\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdomain\u001b[38;5;241m.\u001b[39mget_workspace_storage_object(\n\u001b[0;32m 95\u001b[0m workspace_id\u001b[38;5;241m=\u001b[39mworkspace_id,\n\u001b[0;32m 96\u001b[0m storage_name\u001b[38;5;241m=\u001b[39mstorage_name,\n\u001b[0;32m 97\u001b[0m src_file\u001b[38;5;241m=\u001b[39msrc_file,\n\u001b[0;32m 98\u001b[0m dst_file\u001b[38;5;241m=\u001b[39mdst_file,\n\u001b[0;32m 99\u001b[0m )\n\u001b[0;32m 100\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\StorageDomain.py:138\u001b[0m, in \u001b[0;36mStorageDomain.get_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, src_file, dst_file)\u001b[0m\n\u001b[0;32m 135\u001b[0m credentials \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39madaptor\u001b[38;5;241m.\u001b[39mgenerate_credentials(workspace_id, storage_name)\n\u001b[0;32m 136\u001b[0m storage_provider\u001b[38;5;241m.\u001b[39msave_naas_credentials(workspace_id, storage_name, credentials)\n\u001b[1;32m--> 138\u001b[0m response \u001b[38;5;241m=\u001b[39m storage_provider\u001b[38;5;241m.\u001b[39mget_workspace_storage_object(workspace_id\u001b[38;5;241m=\u001b[39mworkspace_id, storage_name\u001b[38;5;241m=\u001b[39mstorage_name, src_file\u001b[38;5;241m=\u001b[39msrc_file, dst_file\u001b[38;5;241m=\u001b[39mdst_file)\n\u001b[0;32m 139\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\secondary\\providers\\S3StorageProviderAdaptor.py:102\u001b[0m, in \u001b[0;36mS3StorageProviderAdaptor.get_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, src_file, dst_file)\u001b[0m\n\u001b[0;32m 99\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n\u001b[0;32m 101\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m--> 102\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__handle_exceptions(\u001b[38;5;28mstr\u001b[39m(e))\n\u001b[0;32m 103\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\secondary\\providers\\S3StorageProviderAdaptor.py:265\u001b[0m, in \u001b[0;36mS3StorageProviderAdaptor.__handle_exceptions\u001b[1;34m(self, exception)\u001b[0m\n\u001b[0;32m 263\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m BadRequest(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mBad request. Please retry in few seconds.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 264\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAn error occurred (404)\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m exception \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNot Found\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m exception:\n\u001b[1;32m--> 265\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFile not found.\u001b[39m\u001b[38;5;124m\"\u001b[39m) \n\u001b[0;32m 266\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFilename must be a string or a path-like object\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m exception:\n\u001b[0;32m 267\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFile not found. Must be a string or a path-like object\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
+ "\u001b[1;31mFileNotFoundError\u001b[0m: [FileNotFoundError]: File not found."
+ ]
+ }
+ ],
"source": [
- "get_object = naas_python.storage.get_workspace_storage_object(\n",
+ "object = naas_python.storage.get_workspace_storage_object(\n",
" workspace_id=workspace_id,\n",
" storage_name=storage_name,\n",
" src_file=src_file,\n",
" dst_file=dst_file\n",
")\n",
- "get_object"
+ "object"
]
},
{
@@ -185,10 +220,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": "53a76c73",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "object"
]
},
{
@@ -234,7 +276,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.4"
+ "version": "3.11.5"
}
},
"nbformat": 4,
diff --git a/Naas API/Naas_API_List_Storage_Object.ipynb b/Naas API/Naas_API_List_Storage_Object.ipynb
deleted file mode 100644
index 42620abeee..0000000000
--- a/Naas API/Naas_API_List_Storage_Object.ipynb
+++ /dev/null
@@ -1,244 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "id": "28d10a4c-3c77-4088-9b67-db6e5f1ee7f0",
- "metadata": {},
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "id": "90cdfd58-d74b-4ec9-aea8-72fe64903f81",
- "metadata": {},
- "source": [
- "# Naas API - List Storage Object\n",
- "Give Feedback | Bug report"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "9c897c82-4a8f-4f8c-8b00-dd66e496273b",
- "metadata": {
- "execution": {
- "iopub.execute_input": "2024-06-03T14:17:19.410802Z",
- "iopub.status.busy": "2024-06-03T14:17:19.410576Z",
- "iopub.status.idle": "2024-06-03T14:17:19.420684Z",
- "shell.execute_reply": "2024-06-03T14:17:19.419788Z",
- "shell.execute_reply.started": "2024-06-03T14:17:19.410779Z"
- }
- },
- "source": [
- "**Tags:** #naas #api #storage #list #object"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "20e4f13f-d7c4-4acf-9c53-880545f0ce76",
- "metadata": {
- "execution": {
- "iopub.execute_input": "2024-06-03T14:17:27.697224Z",
- "iopub.status.busy": "2024-06-03T14:17:27.696997Z",
- "iopub.status.idle": "2024-06-03T14:17:27.705749Z",
- "shell.execute_reply": "2024-06-03T14:17:27.704763Z",
- "shell.execute_reply.started": "2024-06-03T14:17:27.697200Z"
- }
- },
- "source": [
- "**Author:** [Loic Laville](https://www.linkedin.com/in/loic-laville/)"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "210c53e9",
- "metadata": {},
- "source": [
- "**Last update:** 2024-07-02 (Created: 2024-06-10)"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "b3ed8dac",
- "metadata": {},
- "source": [
- "**Description:** This notebook demonstrates how to list your file inside your Workspace Storage."
- ]
- },
- {
- "cell_type": "markdown",
- "id": "0de8d719",
- "metadata": {},
- "source": [
- "## Input"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "f9ae1bdf-49b2-4f53-9ae9-b396c4608e9d",
- "metadata": {
- "execution": {
- "iopub.execute_input": "2024-06-03T14:23:07.494752Z",
- "iopub.status.busy": "2024-06-03T14:23:07.494526Z",
- "iopub.status.idle": "2024-06-03T14:23:07.500018Z",
- "shell.execute_reply": "2024-06-03T14:23:07.497930Z",
- "shell.execute_reply.started": "2024-06-03T14:23:07.494728Z"
- }
- },
- "source": [
- "### Import library"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "32fa0149",
- "metadata": {},
- "outputs": [],
- "source": [
- "try:\n",
- " import naas_python\n",
- "except:\n",
- " %pip install naas-python --user\n",
- " import naas_python"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "245593c8",
- "metadata": {},
- "source": [
- "### Setup variables"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "a0c5268d-a14d-42c5-bf93-722f6302cc0a",
- "metadata": {},
- "source": [
- "Required :\n",
- "* `workspace_id` : User Workspace ID\n",
- "* `storage_name` : User Storage\n",
- "* `storage_prefix`: The directory to list"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "97463fa6-6044-4e69-b4ea-59fc0b243dbd",
- "metadata": {
- "tags": []
- },
- "outputs": [],
- "source": [
- "# Required\n",
- "\n",
- "workspace_id = \"f7a7e3a4-6435-48bc-8da3-88d46161c2b8\"\n",
- "storage_name = \"test\"\n",
- "storage_prefix=\"directory-1\""
- ]
- },
- {
- "cell_type": "markdown",
- "id": "627f23e2",
- "metadata": {},
- "source": [
- "## Model"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "482962ed",
- "metadata": {},
- "source": [
- "### List Storage Object"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "4856c7a5",
- "metadata": {},
- "outputs": [],
- "source": [
- "object_list = naas_python.storage.list_workspace_storage_object(\n",
- " workspace_id=workspace_id,\n",
- " storage_name=storage_name,\n",
- " storage_prefix=storage_prefix,\n",
- ")\n",
- "object_list"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "dcfa8e9c",
- "metadata": {},
- "source": [
- "## Output"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "0de0bf16",
- "metadata": {},
- "source": [
- "### Display Result\n",
- "```json\n",
- "{'object': [{\n",
- " 'name': 'my-object.txt.zip', \n",
- " 'type': 'file', \n",
- " 'prefix': '/my-test-dir/', \n",
- " 'size': '0.00', \n",
- " 'lastmodified': '2024-06-10T12:46:38+00:00'}], \n",
- " 'error': {'error': 0, 'message': 'Sucess'}}\n",
- "```"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "1f97ea33",
- "metadata": {},
- "source": [
- "### CLI command"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "41e2fbf0",
- "metadata": {},
- "source": [
- "```sh\n",
- "naas-python storage list-object --help\n",
- "```\n",
- "\n",
- "```sh\n",
- "naas-python storage list-object \\\n",
- "-w 81507a26-3644-496c-a379-4c7021434aa0 \\\n",
- "-s test-storage \\\n",
- "-p my-test-dir\n",
- "```"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.11.4"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}
diff --git a/Naas API/Naas_API_List_Storage_Objects.ipynb b/Naas API/Naas_API_List_Storage_Objects.ipynb
new file mode 100644
index 0000000000..ca03cbf4ee
--- /dev/null
+++ b/Naas API/Naas_API_List_Storage_Objects.ipynb
@@ -0,0 +1,267 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "28d10a4c-3c77-4088-9b67-db6e5f1ee7f0",
+ "metadata": {},
+ "source": [
+ ""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "90cdfd58-d74b-4ec9-aea8-72fe64903f81",
+ "metadata": {},
+ "source": [
+ "# Naas API - List Storage Objects\n",
+ "Give Feedback | Bug report"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9c897c82-4a8f-4f8c-8b00-dd66e496273b",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-06-03T14:17:19.410802Z",
+ "iopub.status.busy": "2024-06-03T14:17:19.410576Z",
+ "iopub.status.idle": "2024-06-03T14:17:19.420684Z",
+ "shell.execute_reply": "2024-06-03T14:17:19.419788Z",
+ "shell.execute_reply.started": "2024-06-03T14:17:19.410779Z"
+ }
+ },
+ "source": [
+ "**Tags:** #naas #api #storage #list #object"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "20e4f13f-d7c4-4acf-9c53-880545f0ce76",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-06-03T14:17:27.697224Z",
+ "iopub.status.busy": "2024-06-03T14:17:27.696997Z",
+ "iopub.status.idle": "2024-06-03T14:17:27.705749Z",
+ "shell.execute_reply": "2024-06-03T14:17:27.704763Z",
+ "shell.execute_reply.started": "2024-06-03T14:17:27.697200Z"
+ }
+ },
+ "source": [
+ "**Author:** [Loic Laville](https://www.linkedin.com/in/loic-laville/)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "210c53e9",
+ "metadata": {},
+ "source": [
+ "**Last update:** 2024-07-02 (Created: 2024-06-10)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b3ed8dac",
+ "metadata": {},
+ "source": [
+ "**Description:** This notebook demonstrates how to list objects inside your workspace storage."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0de8d719",
+ "metadata": {},
+ "source": [
+ "## Input"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f9ae1bdf-49b2-4f53-9ae9-b396c4608e9d",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2024-06-03T14:23:07.494752Z",
+ "iopub.status.busy": "2024-06-03T14:23:07.494526Z",
+ "iopub.status.idle": "2024-06-03T14:23:07.500018Z",
+ "shell.execute_reply": "2024-06-03T14:23:07.497930Z",
+ "shell.execute_reply.started": "2024-06-03T14:23:07.494728Z"
+ }
+ },
+ "source": [
+ "### Import libraries"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "id": "32fa0149",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "try:\n",
+ " import naas_python\n",
+ "except:\n",
+ " %pip install naas-python --user\n",
+ " import naas_python"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "245593c8",
+ "metadata": {},
+ "source": [
+ "### Setup variables"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a0c5268d-a14d-42c5-bf93-722f6302cc0a",
+ "metadata": {},
+ "source": [
+ "Required :\n",
+ "* `workspace_id` : User Workspace ID\n",
+ "* `storage_name` : User Storage\n",
+ "* `storage_prefix`: The directory to list"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "id": "97463fa6-6044-4e69-b4ea-59fc0b243dbd",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "# Required\n",
+ "\n",
+ "workspace_id = \"39e3601a-6f8e-412e-9bd7-1ae772bdc10b\"\n",
+ "storage_name = \"abi\"\n",
+ "storage_prefix = \"datalake\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "627f23e2",
+ "metadata": {},
+ "source": [
+ "## Model"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "482962ed",
+ "metadata": {},
+ "source": [
+ "### List Storage Object"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "id": "4856c7a5",
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "ServiceAuthenticationError",
+ "evalue": "[ServiceAuthenticationError]: Unable to authenticate with the service. Please check your credentials and try again. Details: Not authenticated",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[1;31mHTTPError\u001b[0m Traceback (most recent call last)",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\utils\\domains_base\\secondary\\BaseAPIAdaptor.py:88\u001b[0m, in \u001b[0;36mBaseAPIAdaptor.make_api_request\u001b[1;34m(self, method, url, token, payload, headers)\u001b[0m\n\u001b[0;32m 87\u001b[0m api_response \u001b[38;5;241m=\u001b[39m method(url, data\u001b[38;5;241m=\u001b[39mpayload \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mtype\u001b[39m(payload) \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28mstr\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m json\u001b[38;5;241m.\u001b[39mdumps(payload), headers\u001b[38;5;241m=\u001b[39mheaders)\n\u001b[1;32m---> 88\u001b[0m api_response\u001b[38;5;241m.\u001b[39mraise_for_status()\n\u001b[0;32m 89\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m api_response\n",
+ "File \u001b[1;32mc:\\Users\\flore\\anaconda3\\Lib\\site-packages\\requests\\models.py:1021\u001b[0m, in \u001b[0;36mResponse.raise_for_status\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 1020\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m http_error_msg:\n\u001b[1;32m-> 1021\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m HTTPError(http_error_msg, response\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m)\n",
+ "\u001b[1;31mHTTPError\u001b[0m: 401 Client Error: Unauthorized for url: https://api.naas.ai/workspace/39e3601a-6f8e-412e-9bd7-1ae772bdc10b/storage/abi/?prefix=datalake",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[1;31mServiceAuthenticationError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[1;32mIn[15], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m objects \u001b[38;5;241m=\u001b[39m naas_python\u001b[38;5;241m.\u001b[39mstorage\u001b[38;5;241m.\u001b[39mlist_workspace_storage_object(\n\u001b[0;32m 2\u001b[0m workspace_id\u001b[38;5;241m=\u001b[39mworkspace_id,\n\u001b[0;32m 3\u001b[0m storage_name\u001b[38;5;241m=\u001b[39mstorage_name,\n\u001b[0;32m 4\u001b[0m storage_prefix\u001b[38;5;241m=\u001b[39mstorage_prefix,\n\u001b[0;32m 5\u001b[0m )\n\u001b[0;32m 6\u001b[0m objects\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\primary\\SDKStorageAdaptor.py:49\u001b[0m, in \u001b[0;36mSDKStorageAdaptor.list_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, storage_prefix)\u001b[0m\n\u001b[0;32m 44\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mlist_workspace_storage_object\u001b[39m(\u001b[38;5;28mself\u001b[39m, \n\u001b[0;32m 45\u001b[0m workspace_id: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, \n\u001b[0;32m 46\u001b[0m storage_name: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, \n\u001b[0;32m 47\u001b[0m storage_prefix: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mstr\u001b[39m:\n\u001b[1;32m---> 49\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdomain\u001b[38;5;241m.\u001b[39mlist_workspace_storage_object(\n\u001b[0;32m 50\u001b[0m workspace_id\u001b[38;5;241m=\u001b[39mworkspace_id,\n\u001b[0;32m 51\u001b[0m storage_name\u001b[38;5;241m=\u001b[39mstorage_name,\n\u001b[0;32m 52\u001b[0m storage_prefix\u001b[38;5;241m=\u001b[39mstorage_prefix,\n\u001b[0;32m 53\u001b[0m )\n\u001b[0;32m 54\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\StorageDomain.py:54\u001b[0m, in \u001b[0;36mStorageDomain.list_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, storage_prefix)\u001b[0m\n\u001b[0;32m 49\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mlist_workspace_storage_object\u001b[39m(\u001b[38;5;28mself\u001b[39m, \n\u001b[0;32m 50\u001b[0m workspace_id: \u001b[38;5;28mstr\u001b[39m, \n\u001b[0;32m 51\u001b[0m storage_name: Storage\u001b[38;5;241m.\u001b[39m__fields__[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[0;32m 52\u001b[0m storage_prefix: Object\u001b[38;5;241m.\u001b[39m__fields__[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mprefix\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[0;32m 53\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mdict\u001b[39m:\n\u001b[1;32m---> 54\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39madaptor\u001b[38;5;241m.\u001b[39mlist_workspace_storage_object(\n\u001b[0;32m 55\u001b[0m workspace_id\u001b[38;5;241m=\u001b[39mworkspace_id,\n\u001b[0;32m 56\u001b[0m storage_name\u001b[38;5;241m=\u001b[39mstorage_name,\n\u001b[0;32m 57\u001b[0m storage_prefix\u001b[38;5;241m=\u001b[39mstorage_prefix,\n\u001b[0;32m 58\u001b[0m )\n\u001b[0;32m 59\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\utils\\domains_base\\secondary\\BaseAPIAdaptor.py:63\u001b[0m, in \u001b[0;36mBaseAPIAdaptor.service_status_decorator..wrapper\u001b[1;34m(self, *args, **kwargs)\u001b[0m\n\u001b[0;32m 61\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrapper\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m 62\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_service_status()\n\u001b[1;32m---> 63\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m func(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\domains\\storage\\adaptors\\secondary\\NaasStorageAPIAdaptor.py:86\u001b[0m, in \u001b[0;36mNaasStorageAPIAdaptor.list_workspace_storage_object\u001b[1;34m(self, workspace_id, storage_name, storage_prefix)\u001b[0m\n\u001b[0;32m 78\u001b[0m \u001b[38;5;129m@BaseAPIAdaptor\u001b[39m\u001b[38;5;241m.\u001b[39mservice_status_decorator\n\u001b[0;32m 79\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mlist_workspace_storage_object\u001b[39m(\u001b[38;5;28mself\u001b[39m, \n\u001b[0;32m 80\u001b[0m workspace_id: \u001b[38;5;28mstr\u001b[39m, \n\u001b[0;32m 81\u001b[0m storage_name: \u001b[38;5;28mstr\u001b[39m,\n\u001b[0;32m 82\u001b[0m storage_prefix: \u001b[38;5;28mstr\u001b[39m,\n\u001b[0;32m 83\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mdict\u001b[39m:\n\u001b[0;32m 84\u001b[0m _url \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhost\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m/workspace/\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mworkspace_id\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m/storage/\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mstorage_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m?prefix=\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mstorage_prefix\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m---> 86\u001b[0m api_response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmake_api_request(\n\u001b[0;32m 87\u001b[0m requests\u001b[38;5;241m.\u001b[39mget,\n\u001b[0;32m 88\u001b[0m _url,\n\u001b[0;32m 89\u001b[0m )\n\u001b[0;32m 90\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__handle_response(api_response)\n",
+ "File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\naas_python\\utils\\domains_base\\secondary\\BaseAPIAdaptor.py:101\u001b[0m, in \u001b[0;36mBaseAPIAdaptor.make_api_request\u001b[1;34m(self, method, url, token, payload, headers)\u001b[0m\n\u001b[0;32m 99\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 100\u001b[0m _message \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnauthorized\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m--> 101\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ServiceAuthenticationError(\n\u001b[0;32m 102\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnable to authenticate with the service. Please check your credentials and try again. Details: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m_message\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 103\u001b[0m e,\n\u001b[0;32m 104\u001b[0m )\n\u001b[0;32m 105\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m api_response\u001b[38;5;241m.\u001b[39mstatus_code \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m500\u001b[39m:\n\u001b[0;32m 106\u001b[0m _message \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\n",
+ "\u001b[1;31mServiceAuthenticationError\u001b[0m: [ServiceAuthenticationError]: Unable to authenticate with the service. Please check your credentials and try again. Details: Not authenticated"
+ ]
+ }
+ ],
+ "source": [
+ "objects = naas_python.storage.list_workspace_storage_object(\n",
+ " workspace_id=workspace_id,\n",
+ " storage_name=storage_name,\n",
+ " storage_prefix=storage_prefix,\n",
+ ")\n",
+ "objects"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "dcfa8e9c",
+ "metadata": {},
+ "source": [
+ "## Output"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0de0bf16",
+ "metadata": {},
+ "source": [
+ "### Display result"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b47f4c6c",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "objects"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1f97ea33",
+ "metadata": {},
+ "source": [
+ "### CLI command"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "41e2fbf0",
+ "metadata": {},
+ "source": [
+ "```sh\n",
+ "naas-python storage list-object --help\n",
+ "```\n",
+ "\n",
+ "```sh\n",
+ "naas-python storage list-object \\\n",
+ "-w 81507a26-3644-496c-a379-4c7021434aa0 \\\n",
+ "-s test-storage \\\n",
+ "-p my-test-dir\n",
+ "```"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.11.5"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/Naas API/Naas_API_List_Storage.ipynb b/Naas API/Naas_API_List_Storages.ipynb
similarity index 90%
rename from Naas API/Naas_API_List_Storage.ipynb
rename to Naas API/Naas_API_List_Storages.ipynb
index 24dee57058..0bf950d878 100644
--- a/Naas API/Naas_API_List_Storage.ipynb
+++ b/Naas API/Naas_API_List_Storages.ipynb
@@ -13,7 +13,7 @@
"id": "90cdfd58-d74b-4ec9-aea8-72fe64903f81",
"metadata": {},
"source": [
- "# Naas API - List Storage\n",
+ "# Naas API - List Storages\n",
"Give Feedback | Bug report"
]
},
@@ -86,7 +86,7 @@
}
},
"source": [
- "### Import library"
+ "### Import libraries"
]
},
{
@@ -131,7 +131,7 @@
"source": [
"# Required\n",
"\n",
- "workspace_id = \"f7a7e3a4-6435-48bc-8da3-88d46161c2b8\""
+ "workspace_id = \"39e3601a-6f8e-412e-9bd7-1ae772bdc10b\""
]
},
{
@@ -147,7 +147,7 @@
"id": "482962ed",
"metadata": {},
"source": [
- "### Delete storage"
+ "### List storage"
]
},
{
@@ -157,10 +157,10 @@
"metadata": {},
"outputs": [],
"source": [
- "storage_list = naas_python.storage.list_workspace_storage(\n",
+ "storage = naas_python.storage.list_workspace_storage(\n",
" workspace_id=workspace_id\n",
")\n",
- "storage_list"
+ "storage"
]
},
{
@@ -176,21 +176,18 @@
"id": "0de0bf16",
"metadata": {},
"source": [
- "### Display Result"
+ "### Display result"
]
},
{
- "cell_type": "markdown",
- "id": "e4761017",
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "331f945c",
"metadata": {},
+ "outputs": [],
"source": [
- "```json\n",
- "{'storage': [{'name': 'test-storage'},\n",
- " {'name': 'test-storage2'},\n",
- " {'name': 'test'},\n",
- " {'name': 'testlib'}],\n",
- " 'error': {'error': 0, 'message': 'Sucess'}}\n",
- "```"
+ "storage_list = storage.get(\"storage\")\n",
+ "storage_list"
]
},
{
@@ -225,7 +222,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.4"
+ "version": "3.11.5"
}
},
"nbformat": 4,