This is an automated email from the ASF dual-hosted git repository.
dimuthuupe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-mft.git
The following commit(s) were added to refs/heads/master by this push:
new e72eaa8 Adding swift api to python sdk and fixing importing issues
e72eaa8 is described below
commit e72eaa81dd54b452cfd073c2fe0567ef9fbbfe09
Author: Dimuthu Wannipurage <[email protected]>
AuthorDate: Sat May 7 01:44:37 2022 -0400
Adding swift api to python sdk and fixing importing issues
---
python-sdk/samples/sample.py | 24 +++++++++++
python-sdk/setup.cfg | 2 +-
python-sdk/src/airavata_mft_sdk/generate-stubs.sh | 7 ++++
python-sdk/src/airavata_mft_sdk/mft_client.py | 18 +++++++++
.../resource/ResourceService_pb2.py | 47 +++++++++++-----------
.../resourcesecretmap/StorageSecretMap_pb2.py | 42 +++++++++----------
6 files changed, 95 insertions(+), 45 deletions(-)
diff --git a/python-sdk/samples/sample.py b/python-sdk/samples/sample.py
new file mode 100644
index 0000000..0ad6ec1
--- /dev/null
+++ b/python-sdk/samples/sample.py
@@ -0,0 +1,24 @@
+from airavata_mft_sdk import mft_client
+from airavata_mft_sdk import MFTTransferApi_pb2
+from airavata_mft_sdk.s3 import S3Storage_pb2
+
+client = mft_client.MFTClient()
+
+
+
+create_request = S3Storage_pb2.S3StorageCreateRequest(bucketName = "bucket",
+ region = "us-east",
+ storageId =
"some_id",
+ endpoint =
"https://endpoint.url",
+ name = "s3-storage")
+
+print(client.s3_storage_api.createS3Storage(create_request))
+
+transfer_request =
MFTTransferApi_pb2.TransferApiRequest(sourceResourceId="source_id",
+ sourceType = "S3",
+ sourceToken =
"source_token",
+ destinationResourceId
= "dest_id",
+ destinationType =
"S3",
+ destinationToken =
"dest_token")
+print(client.transfer_api.submitTransfer(transfer_request))
+
diff --git a/python-sdk/setup.cfg b/python-sdk/setup.cfg
index 5ee51e0..3b60d7e 100644
--- a/python-sdk/setup.cfg
+++ b/python-sdk/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = airavata_mft_sdk
-version = 0.0.1-alpha5
+version = 0.0.1-alpha11
author = Airavata MFT Developers
author_email = [email protected]
description = Python SDK for Apache Airavata Managed File Transfers (MFT)
diff --git a/python-sdk/src/airavata_mft_sdk/generate-stubs.sh
b/python-sdk/src/airavata_mft_sdk/generate-stubs.sh
index 6335d79..60319de 100755
--- a/python-sdk/src/airavata_mft_sdk/generate-stubs.sh
+++ b/python-sdk/src/airavata_mft_sdk/generate-stubs.sh
@@ -37,6 +37,8 @@ python3 -m grpc_tools.protoc
--proto_path=../../../services/resource-service/stu
../../../services/resource-service/stub/src/main/proto/box/BoxStorage.proto \
../../../services/resource-service/stub/src/main/proto/azure/AzureStorageService.proto
\
../../../services/resource-service/stub/src/main/proto/azure/AzureStorage.proto
\
+
../../../services/resource-service/stub/src/main/proto/swift/SwiftStorageService.proto
\
+
../../../services/resource-service/stub/src/main/proto/swift/SwiftStorage.proto
\
--python_out=$RESOURCE_DIR --grpc_python_out=$RESOURCE_DIR
@@ -57,6 +59,8 @@ python3 -m grpc_tools.protoc
--proto_path=../../../services/secret-service/stub/
../../../services/secret-service/stub/src/main/proto/s3/S3SecretService.proto \
../../../services/secret-service/stub/src/main/proto/scp/SCPCredential.proto \
../../../services/secret-service/stub/src/main/proto/scp/SCPSecretService.proto
\
+
../../../services/secret-service/stub/src/main/proto/swift/SwiftCredential.proto
\
+
../../../services/secret-service/stub/src/main/proto/swift/SwiftSecretService.proto
\
--python_out=$SECRET_DIR --grpc_python_out=$SECRET_DIR
python3 -m grpc_tools.protoc --proto_path=../../../api/stub/src/main/proto \
@@ -76,6 +80,7 @@ touch resource/__init__.py
touch resourcesecretmap/__init__.py
touch s3/__init__.py
touch scp/__init__.py
+touch swift/__init__.py
sed -i 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' azure/*.py
@@ -88,6 +93,7 @@ sed -i 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/'
resource/*.py
sed -i 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/'
resourcesecretmap/*.py
sed -i 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' s3/*.py
sed -i 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' scp/*.py
+sed -i 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' swift/*.py
sed -i 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' *pb2.py
sed -i 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' *pb2_grpc.py
@@ -101,5 +107,6 @@ sed -i 's/^import \([^)]*\)pb2/import
airavata_mft_sdk.\1pb2/' resource/*.py
sed -i 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/'
resourcesecretmap/*.py
sed -i 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' s3/*.py
sed -i 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' scp/*.py
+sed -i 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' swift/*.py
sed -i 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' *pb2.py
sed -i 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' *pb2_grpc.py
\ No newline at end of file
diff --git a/python-sdk/src/airavata_mft_sdk/mft_client.py
b/python-sdk/src/airavata_mft_sdk/mft_client.py
index ce9ce86..56f362c 100644
--- a/python-sdk/src/airavata_mft_sdk/mft_client.py
+++ b/python-sdk/src/airavata_mft_sdk/mft_client.py
@@ -1,7 +1,25 @@
import grpc
import airavata_mft_sdk.MFTTransferApi_pb2_grpc as transfer_grpc
+from airavata_mft_sdk.resource import ResourceService_pb2_grpc
+from airavata_mft_sdk.azure import AzureStorageService_pb2_grpc
+from airavata_mft_sdk.box import BoxStorageService_pb2_grpc
+from airavata_mft_sdk.dropbox import DropboxStorageService_pb2_grpc
+from airavata_mft_sdk.ftp import FTPStorageService_pb2_grpc
+from airavata_mft_sdk.gcs import GCSStorageService_pb2_grpc
+from airavata_mft_sdk.local import LocalStorageService_pb2_grpc
+from airavata_mft_sdk.s3 import S3StorageService_pb2_grpc
+from airavata_mft_sdk.scp import SCPStorageService_pb2_grpc
+from airavata_mft_sdk.resourcesecretmap import StorageSecretMap_pb2_grpc
+from airavata_mft_sdk.azure import AzureSecretService_pb2_grpc
+from airavata_mft_sdk.box import BoxSecretService_pb2_grpc
+from airavata_mft_sdk.dropbox import DropboxSecretService_pb2_grpc
+from airavata_mft_sdk.ftp import FTPSecretService_pb2_grpc
+from airavata_mft_sdk.gcs import GCSSecretService_pb2_grpc
+from airavata_mft_sdk.s3 import S3SecretService_pb2_grpc
+from airavata_mft_sdk.scp import SCPSecretService_pb2_grpc
+
class MFTClient:
def __init__(self, transfer_api_host = "localhost",
diff --git a/python-sdk/src/airavata_mft_sdk/resource/ResourceService_pb2.py
b/python-sdk/src/airavata_mft_sdk/resource/ResourceService_pb2.py
index 2b9dfd1..ab5b1f2 100644
--- a/python-sdk/src/airavata_mft_sdk/resource/ResourceService_pb2.py
+++ b/python-sdk/src/airavata_mft_sdk/resource/ResourceService_pb2.py
@@ -20,10 +20,11 @@ from airavata_mft_sdk.gcs import GCSStorage_pb2 as
gcs_dot_GCSStorage__pb2
from airavata_mft_sdk.local import LocalStorage_pb2 as
local_dot_LocalStorage__pb2
from airavata_mft_sdk.s3 import S3Storage_pb2 as s3_dot_S3Storage__pb2
from airavata_mft_sdk.scp import SCPStorage_pb2 as scp_dot_SCPStorage__pb2
+from airavata_mft_sdk.swift import SwiftStorage_pb2 as
swift_dot_SwiftStorage__pb2
import airavata_mft_sdk.CredCommon_pb2 as CredCommon__pb2
-DESCRIPTOR =
_descriptor_pool.Default().AddSerializedFile(b'\n\x1eresource/ResourceService.proto\x12-org.apache.airavata.mft.resource.stubs.common\x1a\x18\x61zure/AzureStorage.proto\x1a\x14\x62ox/BoxStorage.proto\x1a\x1c\x64ropbox/DropboxStorage.proto\x1a\x14\x66tp/FTPStorage.proto\x1a\x14gcs/GCSStorage.proto\x1a\x18local/LocalStorage.proto\x1a\x12s3/S3Storage.proto\x1a\x14scp/SCPStorage.proto\x1a\x10\x43redCommon.proto\"$\n\x0c\x46ileResource\x12\x14\n\x0cresourcePath\x18\x01
\x01(\t\") [...]
+DESCRIPTOR =
_descriptor_pool.Default().AddSerializedFile(b'\n\x1eresource/ResourceService.proto\x12-org.apache.airavata.mft.resource.stubs.common\x1a\x18\x61zure/AzureStorage.proto\x1a\x14\x62ox/BoxStorage.proto\x1a\x1c\x64ropbox/DropboxStorage.proto\x1a\x14\x66tp/FTPStorage.proto\x1a\x14gcs/GCSStorage.proto\x1a\x18local/LocalStorage.proto\x1a\x12s3/S3Storage.proto\x1a\x14scp/SCPStorage.proto\x1a\x18swift/SwiftStorage.proto\x1a\x10\x43redCommon.proto\"$\n\x0c\x46ileResource\x12\x14\n\x0
[...]
@@ -105,26 +106,26 @@ if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'P\001'
- _FILERESOURCE._serialized_start=289
- _FILERESOURCE._serialized_end=325
- _DIRECTORYRESOURCE._serialized_start=327
- _DIRECTORYRESOURCE._serialized_end=368
- _GENERICRESOURCE._serialized_start=371
- _GENERICRESOURCE._serialized_end=1304
- _GENERICRESOURCEGETREQUEST._serialized_start=1306
- _GENERICRESOURCEGETREQUEST._serialized_end=1416
- _GENERICRESOURCECREATEREQUEST._serialized_start=1419
- _GENERICRESOURCECREATEREQUEST._serialized_end=1911
- _GENERICRESOURCECREATEREQUEST_STORAGETYPE._serialized_start=1807
- _GENERICRESOURCECREATEREQUEST_STORAGETYPE._serialized_end=1899
- _GENERICRESOURCEUPDATEREQUEST._serialized_start=1914
- _GENERICRESOURCEUPDATEREQUEST._serialized_end=2222
- _GENERICRESOURCEUPDATERESPONSE._serialized_start=2224
- _GENERICRESOURCEUPDATERESPONSE._serialized_end=2275
- _GENERICRESOURCEDELETEREQUEST._serialized_start=2277
- _GENERICRESOURCEDELETEREQUEST._serialized_end=2390
- _GENERICRESOURCEDELETERESPONSE._serialized_start=2392
- _GENERICRESOURCEDELETERESPONSE._serialized_end=2439
- _GENERICRESOURCESERVICE._serialized_start=2442
- _GENERICRESOURCESERVICE._serialized_end=3156
+ _FILERESOURCE._serialized_start=315
+ _FILERESOURCE._serialized_end=351
+ _DIRECTORYRESOURCE._serialized_start=353
+ _DIRECTORYRESOURCE._serialized_end=394
+ _GENERICRESOURCE._serialized_start=397
+ _GENERICRESOURCE._serialized_end=1422
+ _GENERICRESOURCEGETREQUEST._serialized_start=1424
+ _GENERICRESOURCEGETREQUEST._serialized_end=1534
+ _GENERICRESOURCECREATEREQUEST._serialized_start=1537
+ _GENERICRESOURCECREATEREQUEST._serialized_end=2040
+ _GENERICRESOURCECREATEREQUEST_STORAGETYPE._serialized_start=1925
+ _GENERICRESOURCECREATEREQUEST_STORAGETYPE._serialized_end=2028
+ _GENERICRESOURCEUPDATEREQUEST._serialized_start=2043
+ _GENERICRESOURCEUPDATEREQUEST._serialized_end=2351
+ _GENERICRESOURCEUPDATERESPONSE._serialized_start=2353
+ _GENERICRESOURCEUPDATERESPONSE._serialized_end=2404
+ _GENERICRESOURCEDELETEREQUEST._serialized_start=2406
+ _GENERICRESOURCEDELETEREQUEST._serialized_end=2519
+ _GENERICRESOURCEDELETERESPONSE._serialized_start=2521
+ _GENERICRESOURCEDELETERESPONSE._serialized_end=2568
+ _GENERICRESOURCESERVICE._serialized_start=2571
+ _GENERICRESOURCESERVICE._serialized_end=3285
# @@protoc_insertion_point(module_scope)
diff --git
a/python-sdk/src/airavata_mft_sdk/resourcesecretmap/StorageSecretMap_pb2.py
b/python-sdk/src/airavata_mft_sdk/resourcesecretmap/StorageSecretMap_pb2.py
index 7706614..36a2993 100644
--- a/python-sdk/src/airavata_mft_sdk/resourcesecretmap/StorageSecretMap_pb2.py
+++ b/python-sdk/src/airavata_mft_sdk/resourcesecretmap/StorageSecretMap_pb2.py
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
import airavata_mft_sdk.CredCommon_pb2 as CredCommon__pb2
-DESCRIPTOR =
_descriptor_pool.Default().AddSerializedFile(b'\n(resourcesecretmap/StorageSecretMap.proto\x12\x33org.apache.airavata.mft.storage.stubs.storagesecret\x1a\x10\x43redCommon.proto\"\xfc\x01\n\rStorageSecret\x12\n\n\x02id\x18\x01
\x01(\t\x12\x11\n\tstorageId\x18\x02 \x01(\t\x12\x10\n\x08secretId\x18\x03
\x01(\t\x12\\\n\x04type\x18\x04
\x01(\x0e\x32N.org.apache.airavata.mft.storage.stubs.storagesecret.StorageSecret.StorageType\"\\\n\x0bStorageType\x12\x06\n\x02S3\x10\x00\x12\x07\
[...]
+DESCRIPTOR =
_descriptor_pool.Default().AddSerializedFile(b'\n(resourcesecretmap/StorageSecretMap.proto\x12\x33org.apache.airavata.mft.storage.stubs.storagesecret\x1a\x10\x43redCommon.proto\"\x87\x02\n\rStorageSecret\x12\n\n\x02id\x18\x01
\x01(\t\x12\x11\n\tstorageId\x18\x02 \x01(\t\x12\x10\n\x08secretId\x18\x03
\x01(\t\x12\\\n\x04type\x18\x04
\x01(\x0e\x32N.org.apache.airavata.mft.storage.stubs.storagesecret.StorageSecret.StorageType\"g\n\x0bStorageType\x12\x06\n\x02S3\x10\x00\x12\x07\n
[...]
@@ -98,25 +98,25 @@ if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'P\001'
_STORAGESECRET._serialized_start=116
- _STORAGESECRET._serialized_end=368
+ _STORAGESECRET._serialized_end=379
_STORAGESECRET_STORAGETYPE._serialized_start=276
- _STORAGESECRET_STORAGETYPE._serialized_end=368
- _STORAGESECRETCREATEREQUEST._serialized_start=371
- _STORAGESECRETCREATEREQUEST._serialized_end=593
- _STORAGESECRETDELETEREQUEST._serialized_start=595
- _STORAGESECRETDELETEREQUEST._serialized_end=698
- _STORAGESECRETDELETERESPONSE._serialized_start=700
- _STORAGESECRETDELETERESPONSE._serialized_end=745
- _STORAGESECRETUPDATEREQUEST._serialized_start=748
- _STORAGESECRETUPDATEREQUEST._serialized_end=930
- _STORAGESECRETUPDATERESPONSE._serialized_start=932
- _STORAGESECRETUPDATERESPONSE._serialized_end=1052
- _STORAGESECRETGETREQUEST._serialized_start=1054
- _STORAGESECRETGETREQUEST._serialized_end=1154
- _STORAGESECRETSEARCHREQUEST._serialized_start=1157
- _STORAGESECRETSEARCHREQUEST._serialized_end=1361
- _STORAGESECRETSEARCHRESPONSE._serialized_start=1363
- _STORAGESECRETSEARCHRESPONSE._serialized_end=1483
- _STORAGESECRETSERVICE._serialized_start=1486
- _STORAGESECRETSERVICE._serialized_end=2409
+ _STORAGESECRET_STORAGETYPE._serialized_end=379
+ _STORAGESECRETCREATEREQUEST._serialized_start=382
+ _STORAGESECRETCREATEREQUEST._serialized_end=604
+ _STORAGESECRETDELETEREQUEST._serialized_start=606
+ _STORAGESECRETDELETEREQUEST._serialized_end=709
+ _STORAGESECRETDELETERESPONSE._serialized_start=711
+ _STORAGESECRETDELETERESPONSE._serialized_end=756
+ _STORAGESECRETUPDATEREQUEST._serialized_start=759
+ _STORAGESECRETUPDATEREQUEST._serialized_end=941
+ _STORAGESECRETUPDATERESPONSE._serialized_start=943
+ _STORAGESECRETUPDATERESPONSE._serialized_end=1063
+ _STORAGESECRETGETREQUEST._serialized_start=1065
+ _STORAGESECRETGETREQUEST._serialized_end=1165
+ _STORAGESECRETSEARCHREQUEST._serialized_start=1168
+ _STORAGESECRETSEARCHREQUEST._serialized_end=1372
+ _STORAGESECRETSEARCHRESPONSE._serialized_start=1374
+ _STORAGESECRETSEARCHRESPONSE._serialized_end=1494
+ _STORAGESECRETSERVICE._serialized_start=1497
+ _STORAGESECRETSERVICE._serialized_end=2420
# @@protoc_insertion_point(module_scope)