You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2023/07/19 15:03:50 UTC
[airavata-mft] branch master updated: HTTP Transport implementation
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 3c1ddf6 HTTP Transport implementation
3c1ddf6 is described below
commit 3c1ddf69b817046331b3fdbe1d457bf1e02917c4
Author: DImuthuUpe <di...@gmail.com>
AuthorDate: Wed Jul 19 11:03:42 2023 -0400
HTTP Transport implementation
---
.../mft/agent/transport/ConnectorResolver.java | 3 +
.../agent/transport/MetadataCollectorResolver.java | 3 +
agent/stub/pom.xml | 2 +
agent/stub/src/main/proto/MFTAgentStubs.proto | 4 +
.../airavata/mft/api/handler/MFTApiHandler.java | 16 ++
.../airavata/mft/controller/RequestBuilder.java | 44 +++--
.../mft_cli/airavata_mft_cli/storage/__init__.py | 7 +-
.../mft_cli/airavata_mft_cli/storage/http.py | 80 +++++++++
python-cli/mft_cli/airavata_mft_cli/util.py | 8 +-
python-cli/mft_cli/pyproject.toml | 4 +-
python-sdk/setup.cfg | 2 +-
.../src/airavata_mft_sdk/MFTAgentStubs_pb2.py | 40 +++--
.../airavata_mft_sdk/common/StorageCommon_pb2.py | 13 +-
python-sdk/src/airavata_mft_sdk/generate-stubs.sh | 7 +
.../http/HTTPStorageService_pb2.py | 29 +++
.../http/HTTPStorageService_pb2_grpc.py | 199 +++++++++++++++++++++
.../src/airavata_mft_sdk/http/HTTPStorage_pb2.py | 115 ++++++++++++
.../airavata_mft_sdk/http/HTTPStorage_pb2_grpc.py | 4 +
.../airavata_mft_sdk/http/HttpCredential_pb2.py | 116 ++++++++++++
.../http/HttpCredential_pb2_grpc.py | 4 +
.../airavata_mft_sdk/http/HttpSecretService_pb2.py | 29 +++
.../http/HttpSecretService_pb2_grpc.py | 165 +++++++++++++++++
python-sdk/src/airavata_mft_sdk/http/__init__.py | 0
python-sdk/src/airavata_mft_sdk/mft_client.py | 4 +
.../mft/resource/client/StorageServiceClient.java | 5 +
.../resource/server/backend/ResourceBackend.java | 8 +
.../server/backend/sql/SQLResourceBackend.java | 46 ++++-
.../backend/sql/entity/GenericResourceEntity.java | 2 +-
.../backend/sql/entity/HttpStorageEntity.java | 48 +++++
.../backend/sql/entity/ResolveStorageEntity.java | 2 +-
.../sql/repository/HttpStorageRepository.java | 30 ++++
.../server/handler/HttpServiceHandler.java | 107 +++++++++++
.../stub/src/main/proto/common/StorageCommon.proto | 1 +
.../stub/src/main/proto/http/HTTPStorage.proto | 66 +++++++
.../src/main/proto/http/HTTPStorageService.proto | 42 +++++
.../mft/secret/client/SecretServiceClient.java | 5 +
.../mft/secret/server/backend/SecretBackend.java | 6 +
.../server/backend/sql/SQLSecretBackend.java | 117 ++++++++++++
.../sql/entity/http/BasicAuthSecretEntity.java | 48 +++++
.../backend/sql/entity/http/HttpSecretEntity.java | 51 ++++++
.../sql/entity/http/TokenAuthSecretEntity.java | 36 ++++
.../repository/http/BasicAuthSecretRepository.java | 28 +++
.../sql/repository/http/HttpSecretRepository.java | 27 +++
.../repository/http/TokenAuthSecretRepository.java | 27 +++
.../secret/server/handler/HttpServiceHandler.java | 103 +++++++++++
.../stub/src/main/proto/http/HttpCredential.proto | 68 +++++++
.../src/main/proto/http/HttpSecretService.proto | 37 ++++
.../src/main/resources/application.properties | 2 +-
transport/http-transport/pom.xml | 74 ++++++++
.../src/main/assembly/transport-assembly.xml | 53 ++++++
.../http/HttpIncomingStreamingConnector.java | 108 +++++++++++
.../mft/trnasport/http/HttpMetadataCollector.java | 87 +++++++++
transport/pom.xml | 1 +
53 files changed, 2085 insertions(+), 48 deletions(-)
diff --git a/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/ConnectorResolver.java b/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/ConnectorResolver.java
index ba2186f..44b1464 100644
--- a/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/ConnectorResolver.java
+++ b/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/ConnectorResolver.java
@@ -48,6 +48,9 @@ public final class ConnectorResolver {
case "LOCAL":
className = "org.apache.airavata.mft.transport.local.LocalIncomingStreamingConnector";
break;
+ case "HTTP":
+ className = "org.apache.airavata.mft.trnasport.http.HttpIncomingStreamingConnector";
+ break;
}
if (className != null) {
diff --git a/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/MetadataCollectorResolver.java b/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/MetadataCollectorResolver.java
index f0b4d08..e667929 100644
--- a/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/MetadataCollectorResolver.java
+++ b/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/MetadataCollectorResolver.java
@@ -56,6 +56,9 @@ public final class MetadataCollectorResolver {
case "ODATA":
className = "org.apache.airavata.mft.transport.odata.ODataMetadataCollector";
break;
+ case "HTTP":
+ className = "org.apache.airavata.mft.trnasport.http.HttpMetadataCollector";
+ break;
}
if (className != null) {
diff --git a/agent/stub/pom.xml b/agent/stub/pom.xml
index 609e689..58dcc0a 100644
--- a/agent/stub/pom.xml
+++ b/agent/stub/pom.xml
@@ -73,6 +73,7 @@
<additionalProtoPathElement>../../services/resource-service/stub/src/main/proto/s3</additionalProtoPathElement>
<additionalProtoPathElement>../../services/resource-service/stub/src/main/proto/scp</additionalProtoPathElement>
<additionalProtoPathElement>../../services/resource-service/stub/src/main/proto/swift</additionalProtoPathElement>
+ <additionalProtoPathElement>../../services/resource-service/stub/src/main/proto/http</additionalProtoPathElement>
<additionalProtoPathElement>../../services/secret-service/stub/src/main/proto/azure</additionalProtoPathElement>
<additionalProtoPathElement>../../services/secret-service/stub/src/main/proto/box</additionalProtoPathElement>
<additionalProtoPathElement>../../services/secret-service/stub/src/main/proto/dropbox</additionalProtoPathElement>
@@ -82,6 +83,7 @@
<additionalProtoPathElement>../../services/secret-service/stub/src/main/proto/s3</additionalProtoPathElement>
<additionalProtoPathElement>../../services/secret-service/stub/src/main/proto/scp</additionalProtoPathElement>
<additionalProtoPathElement>../../services/secret-service/stub/src/main/proto/swift</additionalProtoPathElement>
+ <additionalProtoPathElement>../../services/secret-service/stub/src/main/proto/http</additionalProtoPathElement>
</additionalProtoPathElements>
</configuration>
<executions>
diff --git a/agent/stub/src/main/proto/MFTAgentStubs.proto b/agent/stub/src/main/proto/MFTAgentStubs.proto
index 121a2ad..72243bb 100644
--- a/agent/stub/src/main/proto/MFTAgentStubs.proto
+++ b/agent/stub/src/main/proto/MFTAgentStubs.proto
@@ -30,6 +30,7 @@ import "odata/ODataStorage.proto";
import "s3/S3Storage.proto";
import "scp/SCPStorage.proto";
import "swift/SwiftStorage.proto";
+import "http/HTTPStorage.proto";
import "azure/AzureCredential.proto";
import "box/BoxCredential.proto";
@@ -40,6 +41,7 @@ import "odata/ODataCredential.proto";
import "s3/S3Credential.proto";
import "scp/SCPCredential.proto";
import "swift/SwiftCredential.proto";
+import "http/HttpCredential.proto";
message StorageWrapper {
oneof storage {
@@ -53,6 +55,7 @@ message StorageWrapper {
org.apache.airavata.mft.resource.stubs.s3.storage.S3Storage s3 = 8;
org.apache.airavata.mft.resource.stubs.scp.storage.SCPStorage scp = 9;
org.apache.airavata.mft.resource.stubs.swift.storage.SwiftStorage swift = 10;
+ org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorage http = 11;
}
}
@@ -67,6 +70,7 @@ message SecretWrapper {
org.apache.airavata.mft.credential.stubs.s3.S3Secret s3 = 7;
org.apache.airavata.mft.credential.stubs.scp.SCPSecret scp = 8;
org.apache.airavata.mft.credential.stubs.swift.SwiftSecret swift = 9;
+ org.apache.airavata.mft.credential.stubs.http.HTTPSecret http = 10;
}
}
diff --git a/api/service/src/main/java/org/apache/airavata/mft/api/handler/MFTApiHandler.java b/api/service/src/main/java/org/apache/airavata/mft/api/handler/MFTApiHandler.java
index caecae3..1715ae8 100644
--- a/api/service/src/main/java/org/apache/airavata/mft/api/handler/MFTApiHandler.java
+++ b/api/service/src/main/java/org/apache/airavata/mft/api/handler/MFTApiHandler.java
@@ -38,6 +38,8 @@ import org.apache.airavata.mft.credential.stubs.ftp.FTPSecret;
import org.apache.airavata.mft.credential.stubs.ftp.FTPSecretGetRequest;
import org.apache.airavata.mft.credential.stubs.gcs.GCSSecret;
import org.apache.airavata.mft.credential.stubs.gcs.GCSSecretGetRequest;
+import org.apache.airavata.mft.credential.stubs.http.HTTPSecret;
+import org.apache.airavata.mft.credential.stubs.http.HTTPSecretGetRequest;
import org.apache.airavata.mft.credential.stubs.odata.ODataSecret;
import org.apache.airavata.mft.credential.stubs.odata.ODataSecretGetRequest;
import org.apache.airavata.mft.credential.stubs.s3.S3Secret;
@@ -58,6 +60,8 @@ import org.apache.airavata.mft.resource.stubs.ftp.storage.FTPStorage;
import org.apache.airavata.mft.resource.stubs.ftp.storage.FTPStorageGetRequest;
import org.apache.airavata.mft.resource.stubs.gcs.storage.GCSStorage;
import org.apache.airavata.mft.resource.stubs.gcs.storage.GCSStorageGetRequest;
+import org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorage;
+import org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageGetRequest;
import org.apache.airavata.mft.resource.stubs.local.storage.LocalStorage;
import org.apache.airavata.mft.resource.stubs.local.storage.LocalStorageGetRequest;
import org.apache.airavata.mft.resource.stubs.odata.storage.ODataStorage;
@@ -360,6 +364,18 @@ public class MFTApiHandler extends MFTTransferServiceGrpc.MFTTransferServiceImpl
.setStorage(StorageWrapper.newBuilder().setScp(scpStorage).build())
.setSecret(SecretWrapper.newBuilder().setScp(scpSecret).build());
break;
+ case HTTP:
+ HTTPStorage httpStorage = storageClient.http()
+ .getHTTPStorage(HTTPStorageGetRequest.newBuilder()
+ .setStorageId(idRequest.getStorageId()).build());
+ HTTPSecret httpSecret = secretClient.http()
+ .getHTTPSecret(HTTPSecretGetRequest.newBuilder()
+ .setSecretId(idRequest.getSecretId()).build());
+
+ directReqBuilder
+ .setStorage(StorageWrapper.newBuilder().setHttp(httpStorage).build())
+ .setSecret(SecretWrapper.newBuilder().setHttp(httpSecret).build());
+ break;
}
diff --git a/controller/src/main/java/org/apache/airavata/mft/controller/RequestBuilder.java b/controller/src/main/java/org/apache/airavata/mft/controller/RequestBuilder.java
index c1ab9bc..0aaa3c3 100644
--- a/controller/src/main/java/org/apache/airavata/mft/controller/RequestBuilder.java
+++ b/controller/src/main/java/org/apache/airavata/mft/controller/RequestBuilder.java
@@ -31,6 +31,8 @@ import org.apache.airavata.mft.credential.stubs.ftp.FTPSecret;
import org.apache.airavata.mft.credential.stubs.ftp.FTPSecretGetRequest;
import org.apache.airavata.mft.credential.stubs.gcs.GCSSecret;
import org.apache.airavata.mft.credential.stubs.gcs.GCSSecretGetRequest;
+import org.apache.airavata.mft.credential.stubs.http.HTTPSecret;
+import org.apache.airavata.mft.credential.stubs.http.HTTPSecretGetRequest;
import org.apache.airavata.mft.credential.stubs.odata.ODataSecret;
import org.apache.airavata.mft.credential.stubs.odata.ODataSecretGetRequest;
import org.apache.airavata.mft.credential.stubs.s3.S3Secret;
@@ -50,6 +52,8 @@ import org.apache.airavata.mft.resource.stubs.ftp.storage.FTPStorage;
import org.apache.airavata.mft.resource.stubs.ftp.storage.FTPStorageGetRequest;
import org.apache.airavata.mft.resource.stubs.gcs.storage.GCSStorage;
import org.apache.airavata.mft.resource.stubs.gcs.storage.GCSStorageGetRequest;
+import org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorage;
+import org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageGetRequest;
import org.apache.airavata.mft.resource.stubs.local.storage.LocalStorage;
import org.apache.airavata.mft.resource.stubs.local.storage.LocalStorageGetRequest;
import org.apache.airavata.mft.resource.stubs.odata.storage.ODataStorage;
@@ -234,19 +238,33 @@ public class RequestBuilder {
break;
case ODATA:
- ODataStorage odataStorage = storageCache.containsKey(storageId)? storageCache.get(storageId).getOdata():
- storageServiceClient
- .odata()
- .getODataStorage(ODataStorageGetRequest.newBuilder().setStorageId(storageId).build());
- storageBuilder.setOdata(odataStorage);
-
- ODataSecret odataSecret = storageCache.containsKey(secretId)? secretCache.get(secretId).getOdata():
- secretServiceClient
- .odata()
- .getODataSecret(ODataSecretGetRequest.newBuilder().setSecretId(secretId).build());
-
- secretBuilder.setOdata(odataSecret);
- break;
+ ODataStorage odataStorage = storageCache.containsKey(storageId)? storageCache.get(storageId).getOdata():
+ storageServiceClient
+ .odata()
+ .getODataStorage(ODataStorageGetRequest.newBuilder().setStorageId(storageId).build());
+ storageBuilder.setOdata(odataStorage);
+
+ ODataSecret odataSecret = storageCache.containsKey(secretId)? secretCache.get(secretId).getOdata():
+ secretServiceClient
+ .odata()
+ .getODataSecret(ODataSecretGetRequest.newBuilder().setSecretId(secretId).build());
+
+ secretBuilder.setOdata(odataSecret);
+ break;
+ case HTTP:
+ HTTPStorage httpStorage = storageCache.containsKey(storageId)? storageCache.get(storageId).getHttp():
+ storageServiceClient
+ .http()
+ .getHTTPStorage(HTTPStorageGetRequest.newBuilder().setStorageId(storageId).build());
+ storageBuilder.setHttp(httpStorage);
+
+ HTTPSecret httpSecret = storageCache.containsKey(secretId)? secretCache.get(secretId).getHttp():
+ secretServiceClient
+ .http()
+ .getHTTPSecret(HTTPSecretGetRequest.newBuilder().setSecretId(secretId).build());
+
+ secretBuilder.setHttp(httpSecret);
+ break;
}
diff --git a/python-cli/mft_cli/airavata_mft_cli/storage/__init__.py b/python-cli/mft_cli/airavata_mft_cli/storage/__init__.py
index d461682..b2dd0ff 100644
--- a/python-cli/mft_cli/airavata_mft_cli/storage/__init__.py
+++ b/python-cli/mft_cli/airavata_mft_cli/storage/__init__.py
@@ -24,6 +24,7 @@ import airavata_mft_cli.storage.azure as azure
import airavata_mft_cli.storage.gcs as gcs
import airavata_mft_cli.storage.local as local
import airavata_mft_cli.storage.swift as swift
+import airavata_mft_cli.storage.http as http
from airavata_mft_sdk import mft_client
from airavata_mft_sdk.common import StorageCommon_pb2
from rich.console import Console
@@ -34,13 +35,13 @@ sys.path.append('../airavata_mft_cli')
from airavata_mft_cli import config as configcli
from airavata_mft_cli.util import exception_handler
-app = typer.Typer()
+app = typer.Typer(pretty_exceptions_show_locals=True)
@app.command("add")
def add_storage():
try:
title = "Select storage type: "
- options = ["S3", "Google Cloud Storage (GCS)", "Azure Storage", "Openstack SWIFT", "SCP", "FTP", "Box", "DropBox", "OData", "Agent" ]
+ options = ["S3", "Google Cloud Storage (GCS)", "Azure Storage", "Openstack SWIFT", "SCP", "FTP", "Box", "DropBox", "OData", "Agent", "HTTP" ]
option, index = pick(options, title, indicator="=>")
if option == "S3":
s3.handle_add_storage()
@@ -54,6 +55,8 @@ def add_storage():
swift.handle_add_storage()
elif option == "SCP":
scp.handle_add_storage()
+ elif option == "HTTP":
+ http.handle_add_storage()
except Exception as e:
exception_handler(e)
diff --git a/python-cli/mft_cli/airavata_mft_cli/storage/http.py b/python-cli/mft_cli/airavata_mft_cli/storage/http.py
new file mode 100644
index 0000000..d53976e
--- /dev/null
+++ b/python-cli/mft_cli/airavata_mft_cli/storage/http.py
@@ -0,0 +1,80 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from rich import print
+from pick import pick
+import typer
+from airavata_mft_sdk import mft_client
+from airavata_mft_sdk.http import HttpCredential_pb2
+from airavata_mft_sdk.http import HTTPStorage_pb2
+from airavata_mft_sdk import MFTTransferApi_pb2
+from airavata_mft_sdk import MFTAgentStubs_pb2
+from airavata_mft_sdk.common import StorageCommon_pb2
+import configparser
+import os
+import sys
+sys.path.append('../airavata_mft_cli')
+from airavata_mft_cli import config as configcli
+
+def handle_add_storage():
+
+ client = mft_client.MFTClient(transfer_api_port = configcli.transfer_api_port,
+ transfer_api_secured = configcli.transfer_api_secured,
+ resource_service_host = configcli.resource_service_host,
+ resource_service_port = configcli.resource_service_port,
+ resource_service_secured = configcli.resource_service_secured,
+ secret_service_host = configcli.secret_service_host,
+ secret_service_port = configcli.secret_service_port)
+
+ base_url = typer.prompt("Base URL", "sawad")
+ storage_name = typer.prompt("Storage Name", base_url)
+
+ options = ["Basic Auth", "Token" ]
+ option, index = pick(options, "What is the authentication method", indicator="=>")
+
+ if index == 0:
+ user_name = typer.prompt("User Name", "dds")
+ password = typer.prompt("Password", "sasd")
+ basic_auth = HttpCredential_pb2.BasicAuth(userName=user_name, password=password)
+ http_secret = HttpCredential_pb2.HTTPSecret(basic=basic_auth)
+ elif index == 1:
+ token = typer.prompt("Token")
+ token_auth = HttpCredential_pb2.TokenAuth(accessToken=token)
+ http_secret = HttpCredential_pb2.HTTPSecret(token=token_auth)
+
+ secret_create_req= HttpCredential_pb2.HTTPSecretCreateRequest(secret=http_secret)
+ created_secret = client.http_secret_api.createHTTPSecret(secret_create_req)
+
+ http_storage_create_req = HTTPStorage_pb2.HTTPStorageCreateRequest(
+ baseUrl=base_url, name=storage_name)
+
+ print("CP1")
+ print(http_storage_create_req)
+ created_storage = client.http_storage_api.createHTTPStorage(http_storage_create_req)
+
+ secret_for_storage_req = StorageCommon_pb2.SecretForStorage(storageId = created_storage.storageId,
+ secretId = created_secret.secretId,
+ storageType = StorageCommon_pb2.StorageType.HTTP)
+
+ client.common_api.registerSecretForStorage(secret_for_storage_req)
+
+ print("Successfully added the HTTP endpoint...")
+
+
+
diff --git a/python-cli/mft_cli/airavata_mft_cli/util.py b/python-cli/mft_cli/airavata_mft_cli/util.py
index 186a6b5..8235e23 100644
--- a/python-cli/mft_cli/airavata_mft_cli/util.py
+++ b/python-cli/mft_cli/airavata_mft_cli/util.py
@@ -23,4 +23,10 @@ import grpc
def exception_handler(e):
if isinstance(e, grpc.RpcError):
if e.code() == grpc.StatusCode.UNAVAILABLE:
- print(f"MFT server is unavailable")
+ print(f"[bold red]MFT server is unavailable")
+ elif e.code() == grpc.StatusCode.INTERNAL:
+ print("[bold red]" + e.details())
+ else:
+ print(e)
+ else:
+ print(e)
\ No newline at end of file
diff --git a/python-cli/mft_cli/pyproject.toml b/python-cli/mft_cli/pyproject.toml
index fc1bf82..5a33477 100644
--- a/python-cli/mft_cli/pyproject.toml
+++ b/python-cli/mft_cli/pyproject.toml
@@ -18,7 +18,7 @@
[tool.poetry]
name = "airavata-mft-cli"
-version = "0.1.10"
+version = "0.1.11"
description = "Command Line Client for Apache Airavata MFT data transfer software"
authors = [
"Dimuthu Wannipurage <dw...@iu.edu>",
@@ -40,7 +40,7 @@ typer = {extras = ["all"], version = "^0.7.0"}
pick = {version= "2.2.0"}
grpcio= [{version="1.46.3", markers = "platform_machine != 'arm64'"},{version="1.47.0rc1", markers = "platform_machine == 'arm64'"}]
grpcio-tools = [{version="1.46.3", markers = "platform_machine != 'arm64'"},{version="1.47.0rc1", markers = "platform_machine == 'arm64'"}]
-airavata_mft_sdk= {version="0.0.1-alpha27"}
+airavata-mft-sdk = "0.0.1a33"
[build-system]
requires = ["poetry-core"]
diff --git a/python-sdk/setup.cfg b/python-sdk/setup.cfg
index 6c850ae..9d72928 100644
--- a/python-sdk/setup.cfg
+++ b/python-sdk/setup.cfg
@@ -16,7 +16,7 @@
# under the License.
[metadata]
name = airavata_mft_sdk
-version = 0.0.1-alpha27
+version = 0.0.1-alpha33
author = Airavata MFT Developers
author_email = dev@airavata.apache.org
description = Python SDK for Apache Airavata Managed File Transfers (MFT)
diff --git a/python-sdk/src/airavata_mft_sdk/MFTAgentStubs_pb2.py b/python-sdk/src/airavata_mft_sdk/MFTAgentStubs_pb2.py
index 9ff425c..6e72113 100644
--- a/python-sdk/src/airavata_mft_sdk/MFTAgentStubs_pb2.py
+++ b/python-sdk/src/airavata_mft_sdk/MFTAgentStubs_pb2.py
@@ -23,6 +23,7 @@ from airavata_mft_sdk.odata import ODataStorage_pb2 as odata_dot_ODataStorage__p
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
+from airavata_mft_sdk.http import HTTPStorage_pb2 as http_dot_HTTPStorage__pb2
from airavata_mft_sdk.azure import AzureCredential_pb2 as azure_dot_AzureCredential__pb2
from airavata_mft_sdk.box import BoxCredential_pb2 as box_dot_BoxCredential__pb2
from airavata_mft_sdk.dropbox import DropboxCredential_pb2 as dropbox_dot_DropboxCredential__pb2
@@ -32,9 +33,10 @@ from airavata_mft_sdk.odata import ODataCredential_pb2 as odata_dot_ODataCredent
from airavata_mft_sdk.s3 import S3Credential_pb2 as s3_dot_S3Credential__pb2
from airavata_mft_sdk.scp import SCPCredential_pb2 as scp_dot_SCPCredential__pb2
from airavata_mft_sdk.swift import SwiftCredential_pb2 as swift_dot_SwiftCredential__pb2
+from airavata_mft_sdk.http import HttpCredential_pb2 as http_dot_HttpCredential__pb2
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13MFTAgentStubs.proto\x12\"org.apache.airavata.mft.agent.stub\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\x18odata/ODataStorage.proto\x1a\x12s3/S3Storage.proto\x1a\x14scp/SCPStorage.proto\x1a\x18swift/SwiftStorage.proto\x1a\x1b\x61zure/AzureCredential.proto\x1a\x17\x62ox/ [...]
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13MFTAgentStubs.proto\x12\"org.apache.airavata.mft.agent.stub\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\x18odata/ODataStorage.proto\x1a\x12s3/S3Storage.proto\x1a\x14scp/SCPStorage.proto\x1a\x18swift/SwiftStorage.proto\x1a\x16http/HTTPStorage.proto\x1a\x1b\x61zure/AzureC [...]
_METADATAFETCHERROR = DESCRIPTOR.enum_types_by_name['MetadataFetchError']
MetadataFetchError = enum_type_wrapper.EnumTypeWrapper(_METADATAFETCHERROR)
@@ -110,22 +112,22 @@ if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'P\001'
- _METADATAFETCHERROR._serialized_start=3436
- _METADATAFETCHERROR._serialized_end=3490
- _STORAGEWRAPPER._serialized_start=545
- _STORAGEWRAPPER._serialized_end=1395
- _SECRETWRAPPER._serialized_start=1398
- _SECRETWRAPPER._serialized_end=2098
- _ENDPOINTPATHS._serialized_start=2100
- _ENDPOINTPATHS._serialized_end=2160
- _AGENTTRANSFERREQUEST._serialized_start=2163
- _AGENTTRANSFERREQUEST._serialized_end=2584
- _FILEMETADATA._serialized_start=2587
- _FILEMETADATA._serialized_end=2724
- _DIRECTORYMETADATA._serialized_start=2727
- _DIRECTORYMETADATA._serialized_end=2972
- _RESOURCEMETADATA._serialized_start=2975
- _RESOURCEMETADATA._serialized_end=3220
- _GETRESOURCEMETADATAREQUEST._serialized_start=3223
- _GETRESOURCEMETADATAREQUEST._serialized_end=3434
+ _METADATAFETCHERROR._serialized_start=3644
+ _METADATAFETCHERROR._serialized_end=3698
+ _STORAGEWRAPPER._serialized_start=596
+ _STORAGEWRAPPER._serialized_end=1528
+ _SECRETWRAPPER._serialized_start=1531
+ _SECRETWRAPPER._serialized_end=2306
+ _ENDPOINTPATHS._serialized_start=2308
+ _ENDPOINTPATHS._serialized_end=2368
+ _AGENTTRANSFERREQUEST._serialized_start=2371
+ _AGENTTRANSFERREQUEST._serialized_end=2792
+ _FILEMETADATA._serialized_start=2795
+ _FILEMETADATA._serialized_end=2932
+ _DIRECTORYMETADATA._serialized_start=2935
+ _DIRECTORYMETADATA._serialized_end=3180
+ _RESOURCEMETADATA._serialized_start=3183
+ _RESOURCEMETADATA._serialized_end=3428
+ _GETRESOURCEMETADATAREQUEST._serialized_start=3431
+ _GETRESOURCEMETADATAREQUEST._serialized_end=3642
# @@protoc_insertion_point(module_scope)
diff --git a/python-sdk/src/airavata_mft_sdk/common/StorageCommon_pb2.py b/python-sdk/src/airavata_mft_sdk/common/StorageCommon_pb2.py
index 2122e7d..00ff2a6 100644
--- a/python-sdk/src/airavata_mft_sdk/common/StorageCommon_pb2.py
+++ b/python-sdk/src/airavata_mft_sdk/common/StorageCommon_pb2.py
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x63ommon/StorageCommon.proto\x12\x35org.apache.airavata.mft.resource.stubs.storage.common\".\n\x19StorageTypeResolveRequest\x12\x11\n\tstorageId\x18\x01 \x01(\t\"\xea\x01\n\x1aStorageTypeResolveResponse\x12\x11\n\tstorageId\x18\x01 \x01(\t\x12\x13\n\x0bstorageName\x18\x02 \x01(\t\x12W\n\x0bstorageType\x18\x03 \x01(\x0e\x32\x42.org.apache.airavata.mft.resource.stubs.storage.common.StorageType\x12K\n\x05\x65rror\x18\x04 \x0 [...]
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x63ommon/StorageCommon.proto\x12\x35org.apache.airavata.mft.resource.stubs.storage.common\".\n\x19StorageTypeResolveRequest\x12\x11\n\tstorageId\x18\x01 \x01(\t\"\xea\x01\n\x1aStorageTypeResolveResponse\x12\x11\n\tstorageId\x18\x01 \x01(\t\x12\x13\n\x0bstorageName\x18\x02 \x01(\t\x12W\n\x0bstorageType\x18\x03 \x01(\x0e\x32\x42.org.apache.airavata.mft.resource.stubs.storage.common.StorageType\x12K\n\x05\x65rror\x18\x04 \x0 [...]
_STORAGETYPE = DESCRIPTOR.enum_types_by_name['StorageType']
StorageType = enum_type_wrapper.EnumTypeWrapper(_STORAGETYPE)
@@ -31,6 +31,7 @@ GCS = 6
AZURE = 7
SWIFT = 8
ODATA = 9
+HTTP = 10
NOT_FOUND = 0
NO_PERMISSION = 1
LIMIT_OVERFLOWED = 2
@@ -122,9 +123,9 @@ if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'P\001'
_STORAGETYPE._serialized_start=1247
- _STORAGETYPE._serialized_end=1361
- _ERROR._serialized_start=1363
- _ERROR._serialized_end=1426
+ _STORAGETYPE._serialized_end=1371
+ _ERROR._serialized_start=1373
+ _ERROR._serialized_end=1436
_STORAGETYPERESOLVEREQUEST._serialized_start=85
_STORAGETYPERESOLVEREQUEST._serialized_end=131
_STORAGETYPERESOLVERESPONSE._serialized_start=134
@@ -145,6 +146,6 @@ if _descriptor._USE_C_DESCRIPTORS == False:
_STORAGELISTREQUEST._serialized_end=1070
_STORAGESEARCHREQUEST._serialized_start=1073
_STORAGESEARCHREQUEST._serialized_end=1245
- _STORAGECOMMONSERVICE._serialized_start=1429
- _STORAGECOMMONSERVICE._serialized_end=2535
+ _STORAGECOMMONSERVICE._serialized_start=1439
+ _STORAGECOMMONSERVICE._serialized_end=2545
# @@protoc_insertion_point(module_scope)
diff --git a/python-sdk/src/airavata_mft_sdk/generate-stubs.sh b/python-sdk/src/airavata_mft_sdk/generate-stubs.sh
index cf26d62..b1a3695 100755
--- a/python-sdk/src/airavata_mft_sdk/generate-stubs.sh
+++ b/python-sdk/src/airavata_mft_sdk/generate-stubs.sh
@@ -58,6 +58,8 @@ python3 -m grpc_tools.protoc --proto_path=../../../services/resource-service/stu
../../../services/resource-service/stub/src/main/proto/swift/SwiftStorage.proto \
../../../services/resource-service/stub/src/main/proto/odata/ODataStorageService.proto \
../../../services/resource-service/stub/src/main/proto/odata/ODataStorage.proto \
+ ../../../services/resource-service/stub/src/main/proto/http/HTTPStorageService.proto \
+ ../../../services/resource-service/stub/src/main/proto/http/HTTPStorage.proto \
../../../services/resource-service/stub/src/main/proto/common/StorageCommon.proto \
--python_out=$RESOURCE_DIR --grpc_python_out=$RESOURCE_DIR
@@ -83,6 +85,8 @@ python3 -m grpc_tools.protoc --proto_path=../../../services/secret-service/stub/
../../../services/secret-service/stub/src/main/proto/swift/SwiftSecretService.proto \
../../../services/secret-service/stub/src/main/proto/odata/ODataCredential.proto \
../../../services/secret-service/stub/src/main/proto/odata/ODataSecretService.proto \
+ ../../../services/secret-service/stub/src/main/proto/http/HttpCredential.proto \
+ ../../../services/secret-service/stub/src/main/proto/http/HttpSecretService.proto \
--python_out=$SECRET_DIR --grpc_python_out=$SECRET_DIR
echo "Building Agent Stubs........."
@@ -115,6 +119,7 @@ touch s3/__init__.py
touch scp/__init__.py
touch swift/__init__.py
touch odata/__init__.py
+touch http/__init__.py
touch common/__init__.py
@@ -128,6 +133,7 @@ sed -i'.bak' -e 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' s3/*.py
sed -i'.bak' -e 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' scp/*.py
sed -i'.bak' -e 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' swift/*.py
sed -i'.bak' -e 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' odata/*.py
+sed -i'.bak' -e 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' http/*.py
sed -i'.bak' -e 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' common/*.py
sed -i'.bak' -e 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' *pb2.py
sed -i'.bak' -e 's/from \([^)]*\)pb2/from airavata_mft_sdk.\1pb2/' *pb2_grpc.py
@@ -142,6 +148,7 @@ sed -i'.bak' -e 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' s3/*.py
sed -i'.bak' -e 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' scp/*.py
sed -i'.bak' -e 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' swift/*.py
sed -i'.bak' -e 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' odata/*.py
+sed -i'.bak' -e 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' http/*.py
sed -i'.bak' -e 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' common/*.py
sed -i'.bak' -e 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' *pb2.py
sed -i'.bak' -e 's/^import \([^)]*\)pb2/import airavata_mft_sdk.\1pb2/' *pb2_grpc.py
diff --git a/python-sdk/src/airavata_mft_sdk/http/HTTPStorageService_pb2.py b/python-sdk/src/airavata_mft_sdk/http/HTTPStorageService_pb2.py
new file mode 100644
index 0000000..d2328a0
--- /dev/null
+++ b/python-sdk/src/airavata_mft_sdk/http/HTTPStorageService_pb2.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: http/HTTPStorageService.proto
+"""Generated protocol buffer code."""
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from airavata_mft_sdk.http import HTTPStorage_pb2 as http_dot_HTTPStorage__pb2
+
+
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1dhttp/HTTPStorageService.proto\x12-org.apache.airavata.mft.resource.service.http\x1a\x16http/HTTPStorage.proto2\xf5\x06\n\x12HTTPStorageService\x12\xac\x01\n\x0flistHTTPStorage\x12K.org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageListRequest\x1aL.org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageListResponse\x12\x9e\x01\n\x0egetHTTPStorage\x12J.org.apache.airavata.mft.resource.stubs.http.storage. [...]
+
+
+
+_HTTPSTORAGESERVICE = DESCRIPTOR.services_by_name['HTTPStorageService']
+if _descriptor._USE_C_DESCRIPTORS == False:
+
+ DESCRIPTOR._options = None
+ DESCRIPTOR._serialized_options = b'P\001'
+ _HTTPSTORAGESERVICE._serialized_start=105
+ _HTTPSTORAGESERVICE._serialized_end=990
+# @@protoc_insertion_point(module_scope)
diff --git a/python-sdk/src/airavata_mft_sdk/http/HTTPStorageService_pb2_grpc.py b/python-sdk/src/airavata_mft_sdk/http/HTTPStorageService_pb2_grpc.py
new file mode 100644
index 0000000..6258d8f
--- /dev/null
+++ b/python-sdk/src/airavata_mft_sdk/http/HTTPStorageService_pb2_grpc.py
@@ -0,0 +1,199 @@
+# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
+"""Client and server classes corresponding to protobuf-defined services."""
+import grpc
+
+from airavata_mft_sdk.http import HTTPStorage_pb2 as http_dot_HTTPStorage__pb2
+
+
+class HTTPStorageServiceStub(object):
+ """Missing associated documentation comment in .proto file."""
+
+ def __init__(self, channel):
+ """Constructor.
+
+ Args:
+ channel: A grpc.Channel.
+ """
+ self.listHTTPStorage = channel.unary_unary(
+ '/org.apache.airavata.mft.resource.service.http.HTTPStorageService/listHTTPStorage',
+ request_serializer=http_dot_HTTPStorage__pb2.HTTPStorageListRequest.SerializeToString,
+ response_deserializer=http_dot_HTTPStorage__pb2.HTTPStorageListResponse.FromString,
+ )
+ self.getHTTPStorage = channel.unary_unary(
+ '/org.apache.airavata.mft.resource.service.http.HTTPStorageService/getHTTPStorage',
+ request_serializer=http_dot_HTTPStorage__pb2.HTTPStorageGetRequest.SerializeToString,
+ response_deserializer=http_dot_HTTPStorage__pb2.HTTPStorage.FromString,
+ )
+ self.createHTTPStorage = channel.unary_unary(
+ '/org.apache.airavata.mft.resource.service.http.HTTPStorageService/createHTTPStorage',
+ request_serializer=http_dot_HTTPStorage__pb2.HTTPStorageCreateRequest.SerializeToString,
+ response_deserializer=http_dot_HTTPStorage__pb2.HTTPStorage.FromString,
+ )
+ self.updateHTTPStorage = channel.unary_unary(
+ '/org.apache.airavata.mft.resource.service.http.HTTPStorageService/updateHTTPStorage',
+ request_serializer=http_dot_HTTPStorage__pb2.HTTPStorageUpdateRequest.SerializeToString,
+ response_deserializer=http_dot_HTTPStorage__pb2.HTTPStorageUpdateResponse.FromString,
+ )
+ self.deleteHTTPStorage = channel.unary_unary(
+ '/org.apache.airavata.mft.resource.service.http.HTTPStorageService/deleteHTTPStorage',
+ request_serializer=http_dot_HTTPStorage__pb2.HTTPStorageDeleteRequest.SerializeToString,
+ response_deserializer=http_dot_HTTPStorage__pb2.HTTPStorageDeleteResponse.FromString,
+ )
+
+
+class HTTPStorageServiceServicer(object):
+ """Missing associated documentation comment in .proto file."""
+
+ def listHTTPStorage(self, request, context):
+ """Storage
+ """
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def getHTTPStorage(self, request, context):
+ """Missing associated documentation comment in .proto file."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def createHTTPStorage(self, request, context):
+ """Missing associated documentation comment in .proto file."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def updateHTTPStorage(self, request, context):
+ """Missing associated documentation comment in .proto file."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def deleteHTTPStorage(self, request, context):
+ """Missing associated documentation comment in .proto file."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+
+def add_HTTPStorageServiceServicer_to_server(servicer, server):
+ rpc_method_handlers = {
+ 'listHTTPStorage': grpc.unary_unary_rpc_method_handler(
+ servicer.listHTTPStorage,
+ request_deserializer=http_dot_HTTPStorage__pb2.HTTPStorageListRequest.FromString,
+ response_serializer=http_dot_HTTPStorage__pb2.HTTPStorageListResponse.SerializeToString,
+ ),
+ 'getHTTPStorage': grpc.unary_unary_rpc_method_handler(
+ servicer.getHTTPStorage,
+ request_deserializer=http_dot_HTTPStorage__pb2.HTTPStorageGetRequest.FromString,
+ response_serializer=http_dot_HTTPStorage__pb2.HTTPStorage.SerializeToString,
+ ),
+ 'createHTTPStorage': grpc.unary_unary_rpc_method_handler(
+ servicer.createHTTPStorage,
+ request_deserializer=http_dot_HTTPStorage__pb2.HTTPStorageCreateRequest.FromString,
+ response_serializer=http_dot_HTTPStorage__pb2.HTTPStorage.SerializeToString,
+ ),
+ 'updateHTTPStorage': grpc.unary_unary_rpc_method_handler(
+ servicer.updateHTTPStorage,
+ request_deserializer=http_dot_HTTPStorage__pb2.HTTPStorageUpdateRequest.FromString,
+ response_serializer=http_dot_HTTPStorage__pb2.HTTPStorageUpdateResponse.SerializeToString,
+ ),
+ 'deleteHTTPStorage': grpc.unary_unary_rpc_method_handler(
+ servicer.deleteHTTPStorage,
+ request_deserializer=http_dot_HTTPStorage__pb2.HTTPStorageDeleteRequest.FromString,
+ response_serializer=http_dot_HTTPStorage__pb2.HTTPStorageDeleteResponse.SerializeToString,
+ ),
+ }
+ generic_handler = grpc.method_handlers_generic_handler(
+ 'org.apache.airavata.mft.resource.service.http.HTTPStorageService', rpc_method_handlers)
+ server.add_generic_rpc_handlers((generic_handler,))
+
+
+ # This class is part of an EXPERIMENTAL API.
+class HTTPStorageService(object):
+ """Missing associated documentation comment in .proto file."""
+
+ @staticmethod
+ def listHTTPStorage(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/org.apache.airavata.mft.resource.service.http.HTTPStorageService/listHTTPStorage',
+ http_dot_HTTPStorage__pb2.HTTPStorageListRequest.SerializeToString,
+ http_dot_HTTPStorage__pb2.HTTPStorageListResponse.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+ @staticmethod
+ def getHTTPStorage(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/org.apache.airavata.mft.resource.service.http.HTTPStorageService/getHTTPStorage',
+ http_dot_HTTPStorage__pb2.HTTPStorageGetRequest.SerializeToString,
+ http_dot_HTTPStorage__pb2.HTTPStorage.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+ @staticmethod
+ def createHTTPStorage(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/org.apache.airavata.mft.resource.service.http.HTTPStorageService/createHTTPStorage',
+ http_dot_HTTPStorage__pb2.HTTPStorageCreateRequest.SerializeToString,
+ http_dot_HTTPStorage__pb2.HTTPStorage.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+ @staticmethod
+ def updateHTTPStorage(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/org.apache.airavata.mft.resource.service.http.HTTPStorageService/updateHTTPStorage',
+ http_dot_HTTPStorage__pb2.HTTPStorageUpdateRequest.SerializeToString,
+ http_dot_HTTPStorage__pb2.HTTPStorageUpdateResponse.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+ @staticmethod
+ def deleteHTTPStorage(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/org.apache.airavata.mft.resource.service.http.HTTPStorageService/deleteHTTPStorage',
+ http_dot_HTTPStorage__pb2.HTTPStorageDeleteRequest.SerializeToString,
+ http_dot_HTTPStorage__pb2.HTTPStorageDeleteResponse.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
diff --git a/python-sdk/src/airavata_mft_sdk/http/HTTPStorage_pb2.py b/python-sdk/src/airavata_mft_sdk/http/HTTPStorage_pb2.py
new file mode 100644
index 0000000..8af9793
--- /dev/null
+++ b/python-sdk/src/airavata_mft_sdk/http/HTTPStorage_pb2.py
@@ -0,0 +1,115 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: http/HTTPStorage.proto
+"""Generated protocol buffer code."""
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+
+
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16http/HTTPStorage.proto\x12\x33org.apache.airavata.mft.resource.stubs.http.storage\"?\n\x0bHTTPStorage\x12\x11\n\tstorageId\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0f\n\x07\x62\x61seUrl\x18\x03 \x01(\t\"7\n\x16HTTPStorageListRequest\x12\x0e\n\x06offset\x18\x01 \x01(\x05\x12\r\n\x05limit\x18\x02 \x01(\x05\"m\n\x17HTTPStorageListResponse\x12R\n\x08storages\x18\x01 \x03(\x0b\x32@.org.apache.airavata.mft.resource [...]
+
+
+
+_HTTPSTORAGE = DESCRIPTOR.message_types_by_name['HTTPStorage']
+_HTTPSTORAGELISTREQUEST = DESCRIPTOR.message_types_by_name['HTTPStorageListRequest']
+_HTTPSTORAGELISTRESPONSE = DESCRIPTOR.message_types_by_name['HTTPStorageListResponse']
+_HTTPSTORAGEGETREQUEST = DESCRIPTOR.message_types_by_name['HTTPStorageGetRequest']
+_HTTPSTORAGECREATEREQUEST = DESCRIPTOR.message_types_by_name['HTTPStorageCreateRequest']
+_HTTPSTORAGEUPDATEREQUEST = DESCRIPTOR.message_types_by_name['HTTPStorageUpdateRequest']
+_HTTPSTORAGEUPDATERESPONSE = DESCRIPTOR.message_types_by_name['HTTPStorageUpdateResponse']
+_HTTPSTORAGEDELETEREQUEST = DESCRIPTOR.message_types_by_name['HTTPStorageDeleteRequest']
+_HTTPSTORAGEDELETERESPONSE = DESCRIPTOR.message_types_by_name['HTTPStorageDeleteResponse']
+HTTPStorage = _reflection.GeneratedProtocolMessageType('HTTPStorage', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSTORAGE,
+ '__module__' : 'http.HTTPStorage_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorage)
+ })
+_sym_db.RegisterMessage(HTTPStorage)
+
+HTTPStorageListRequest = _reflection.GeneratedProtocolMessageType('HTTPStorageListRequest', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSTORAGELISTREQUEST,
+ '__module__' : 'http.HTTPStorage_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageListRequest)
+ })
+_sym_db.RegisterMessage(HTTPStorageListRequest)
+
+HTTPStorageListResponse = _reflection.GeneratedProtocolMessageType('HTTPStorageListResponse', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSTORAGELISTRESPONSE,
+ '__module__' : 'http.HTTPStorage_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageListResponse)
+ })
+_sym_db.RegisterMessage(HTTPStorageListResponse)
+
+HTTPStorageGetRequest = _reflection.GeneratedProtocolMessageType('HTTPStorageGetRequest', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSTORAGEGETREQUEST,
+ '__module__' : 'http.HTTPStorage_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageGetRequest)
+ })
+_sym_db.RegisterMessage(HTTPStorageGetRequest)
+
+HTTPStorageCreateRequest = _reflection.GeneratedProtocolMessageType('HTTPStorageCreateRequest', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSTORAGECREATEREQUEST,
+ '__module__' : 'http.HTTPStorage_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageCreateRequest)
+ })
+_sym_db.RegisterMessage(HTTPStorageCreateRequest)
+
+HTTPStorageUpdateRequest = _reflection.GeneratedProtocolMessageType('HTTPStorageUpdateRequest', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSTORAGEUPDATEREQUEST,
+ '__module__' : 'http.HTTPStorage_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageUpdateRequest)
+ })
+_sym_db.RegisterMessage(HTTPStorageUpdateRequest)
+
+HTTPStorageUpdateResponse = _reflection.GeneratedProtocolMessageType('HTTPStorageUpdateResponse', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSTORAGEUPDATERESPONSE,
+ '__module__' : 'http.HTTPStorage_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageUpdateResponse)
+ })
+_sym_db.RegisterMessage(HTTPStorageUpdateResponse)
+
+HTTPStorageDeleteRequest = _reflection.GeneratedProtocolMessageType('HTTPStorageDeleteRequest', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSTORAGEDELETEREQUEST,
+ '__module__' : 'http.HTTPStorage_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageDeleteRequest)
+ })
+_sym_db.RegisterMessage(HTTPStorageDeleteRequest)
+
+HTTPStorageDeleteResponse = _reflection.GeneratedProtocolMessageType('HTTPStorageDeleteResponse', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSTORAGEDELETERESPONSE,
+ '__module__' : 'http.HTTPStorage_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageDeleteResponse)
+ })
+_sym_db.RegisterMessage(HTTPStorageDeleteResponse)
+
+if _descriptor._USE_C_DESCRIPTORS == False:
+
+ DESCRIPTOR._options = None
+ DESCRIPTOR._serialized_options = b'P\001'
+ _HTTPSTORAGE._serialized_start=79
+ _HTTPSTORAGE._serialized_end=142
+ _HTTPSTORAGELISTREQUEST._serialized_start=144
+ _HTTPSTORAGELISTREQUEST._serialized_end=199
+ _HTTPSTORAGELISTRESPONSE._serialized_start=201
+ _HTTPSTORAGELISTRESPONSE._serialized_end=310
+ _HTTPSTORAGEGETREQUEST._serialized_start=312
+ _HTTPSTORAGEGETREQUEST._serialized_end=354
+ _HTTPSTORAGECREATEREQUEST._serialized_start=356
+ _HTTPSTORAGECREATEREQUEST._serialized_end=413
+ _HTTPSTORAGEUPDATEREQUEST._serialized_start=415
+ _HTTPSTORAGEUPDATEREQUEST._serialized_end=491
+ _HTTPSTORAGEUPDATERESPONSE._serialized_start=493
+ _HTTPSTORAGEUPDATERESPONSE._serialized_end=539
+ _HTTPSTORAGEDELETEREQUEST._serialized_start=541
+ _HTTPSTORAGEDELETEREQUEST._serialized_end=586
+ _HTTPSTORAGEDELETERESPONSE._serialized_start=588
+ _HTTPSTORAGEDELETERESPONSE._serialized_end=631
+# @@protoc_insertion_point(module_scope)
diff --git a/python-sdk/src/airavata_mft_sdk/http/HTTPStorage_pb2_grpc.py b/python-sdk/src/airavata_mft_sdk/http/HTTPStorage_pb2_grpc.py
new file mode 100644
index 0000000..2daafff
--- /dev/null
+++ b/python-sdk/src/airavata_mft_sdk/http/HTTPStorage_pb2_grpc.py
@@ -0,0 +1,4 @@
+# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
+"""Client and server classes corresponding to protobuf-defined services."""
+import grpc
+
diff --git a/python-sdk/src/airavata_mft_sdk/http/HttpCredential_pb2.py b/python-sdk/src/airavata_mft_sdk/http/HttpCredential_pb2.py
new file mode 100644
index 0000000..eb13c9b
--- /dev/null
+++ b/python-sdk/src/airavata_mft_sdk/http/HttpCredential_pb2.py
@@ -0,0 +1,116 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: http/HttpCredential.proto
+"""Generated protocol buffer code."""
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+import airavata_mft_sdk.CredCommon_pb2 as CredCommon__pb2
+
+
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19http/HttpCredential.proto\x12-org.apache.airavata.mft.credential.stubs.http\x1a\x10\x43redCommon.proto\"/\n\tBasicAuth\x12\x10\n\x08userName\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\" \n\tTokenAuth\x12\x13\n\x0b\x61\x63\x63\x65ssToken\x18\x03 \x01(\t\"\xbc\x01\n\nHTTPSecret\x12\x10\n\x08secretId\x18\x01 \x01(\t\x12I\n\x05\x62\x61sic\x18\x02 \x01(\x0b\x32\x38.org.apache.airavata.mft.credential.stubs.http.BasicA [...]
+
+
+
+_BASICAUTH = DESCRIPTOR.message_types_by_name['BasicAuth']
+_TOKENAUTH = DESCRIPTOR.message_types_by_name['TokenAuth']
+_HTTPSECRET = DESCRIPTOR.message_types_by_name['HTTPSecret']
+_HTTPSECRETGETREQUEST = DESCRIPTOR.message_types_by_name['HTTPSecretGetRequest']
+_HTTPSECRETCREATEREQUEST = DESCRIPTOR.message_types_by_name['HTTPSecretCreateRequest']
+_HTTPSECRETUPDATEREQUEST = DESCRIPTOR.message_types_by_name['HTTPSecretUpdateRequest']
+_HTTPSECRETUPDATERESPONSE = DESCRIPTOR.message_types_by_name['HTTPSecretUpdateResponse']
+_HTTPSECRETDELETEREQUEST = DESCRIPTOR.message_types_by_name['HTTPSecretDeleteRequest']
+_HTTPSECRETDELETERESPONSE = DESCRIPTOR.message_types_by_name['HTTPSecretDeleteResponse']
+BasicAuth = _reflection.GeneratedProtocolMessageType('BasicAuth', (_message.Message,), {
+ 'DESCRIPTOR' : _BASICAUTH,
+ '__module__' : 'http.HttpCredential_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.credential.stubs.http.BasicAuth)
+ })
+_sym_db.RegisterMessage(BasicAuth)
+
+TokenAuth = _reflection.GeneratedProtocolMessageType('TokenAuth', (_message.Message,), {
+ 'DESCRIPTOR' : _TOKENAUTH,
+ '__module__' : 'http.HttpCredential_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.credential.stubs.http.TokenAuth)
+ })
+_sym_db.RegisterMessage(TokenAuth)
+
+HTTPSecret = _reflection.GeneratedProtocolMessageType('HTTPSecret', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSECRET,
+ '__module__' : 'http.HttpCredential_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.credential.stubs.http.HTTPSecret)
+ })
+_sym_db.RegisterMessage(HTTPSecret)
+
+HTTPSecretGetRequest = _reflection.GeneratedProtocolMessageType('HTTPSecretGetRequest', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSECRETGETREQUEST,
+ '__module__' : 'http.HttpCredential_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.credential.stubs.http.HTTPSecretGetRequest)
+ })
+_sym_db.RegisterMessage(HTTPSecretGetRequest)
+
+HTTPSecretCreateRequest = _reflection.GeneratedProtocolMessageType('HTTPSecretCreateRequest', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSECRETCREATEREQUEST,
+ '__module__' : 'http.HttpCredential_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.credential.stubs.http.HTTPSecretCreateRequest)
+ })
+_sym_db.RegisterMessage(HTTPSecretCreateRequest)
+
+HTTPSecretUpdateRequest = _reflection.GeneratedProtocolMessageType('HTTPSecretUpdateRequest', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSECRETUPDATEREQUEST,
+ '__module__' : 'http.HttpCredential_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.credential.stubs.http.HTTPSecretUpdateRequest)
+ })
+_sym_db.RegisterMessage(HTTPSecretUpdateRequest)
+
+HTTPSecretUpdateResponse = _reflection.GeneratedProtocolMessageType('HTTPSecretUpdateResponse', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSECRETUPDATERESPONSE,
+ '__module__' : 'http.HttpCredential_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.credential.stubs.http.HTTPSecretUpdateResponse)
+ })
+_sym_db.RegisterMessage(HTTPSecretUpdateResponse)
+
+HTTPSecretDeleteRequest = _reflection.GeneratedProtocolMessageType('HTTPSecretDeleteRequest', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSECRETDELETEREQUEST,
+ '__module__' : 'http.HttpCredential_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.credential.stubs.http.HTTPSecretDeleteRequest)
+ })
+_sym_db.RegisterMessage(HTTPSecretDeleteRequest)
+
+HTTPSecretDeleteResponse = _reflection.GeneratedProtocolMessageType('HTTPSecretDeleteResponse', (_message.Message,), {
+ 'DESCRIPTOR' : _HTTPSECRETDELETERESPONSE,
+ '__module__' : 'http.HttpCredential_pb2'
+ # @@protoc_insertion_point(class_scope:org.apache.airavata.mft.credential.stubs.http.HTTPSecretDeleteResponse)
+ })
+_sym_db.RegisterMessage(HTTPSecretDeleteResponse)
+
+if _descriptor._USE_C_DESCRIPTORS == False:
+
+ DESCRIPTOR._options = None
+ DESCRIPTOR._serialized_options = b'P\001'
+ _BASICAUTH._serialized_start=94
+ _BASICAUTH._serialized_end=141
+ _TOKENAUTH._serialized_start=143
+ _TOKENAUTH._serialized_end=175
+ _HTTPSECRET._serialized_start=178
+ _HTTPSECRET._serialized_end=366
+ _HTTPSECRETGETREQUEST._serialized_start=368
+ _HTTPSECRETGETREQUEST._serialized_end=471
+ _HTTPSECRETCREATEREQUEST._serialized_start=474
+ _HTTPSECRETCREATEREQUEST._serialized_end=637
+ _HTTPSECRETUPDATEREQUEST._serialized_start=640
+ _HTTPSECRETUPDATEREQUEST._serialized_end=803
+ _HTTPSECRETUPDATERESPONSE._serialized_start=805
+ _HTTPSECRETUPDATERESPONSE._serialized_end=849
+ _HTTPSECRETDELETEREQUEST._serialized_start=851
+ _HTTPSECRETDELETEREQUEST._serialized_end=957
+ _HTTPSECRETDELETERESPONSE._serialized_start=959
+ _HTTPSECRETDELETERESPONSE._serialized_end=1001
+# @@protoc_insertion_point(module_scope)
diff --git a/python-sdk/src/airavata_mft_sdk/http/HttpCredential_pb2_grpc.py b/python-sdk/src/airavata_mft_sdk/http/HttpCredential_pb2_grpc.py
new file mode 100644
index 0000000..2daafff
--- /dev/null
+++ b/python-sdk/src/airavata_mft_sdk/http/HttpCredential_pb2_grpc.py
@@ -0,0 +1,4 @@
+# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
+"""Client and server classes corresponding to protobuf-defined services."""
+import grpc
+
diff --git a/python-sdk/src/airavata_mft_sdk/http/HttpSecretService_pb2.py b/python-sdk/src/airavata_mft_sdk/http/HttpSecretService_pb2.py
new file mode 100644
index 0000000..d09d5e4
--- /dev/null
+++ b/python-sdk/src/airavata_mft_sdk/http/HttpSecretService_pb2.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: http/HttpSecretService.proto
+"""Generated protocol buffer code."""
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from airavata_mft_sdk.http import HttpCredential_pb2 as http_dot_HttpCredential__pb2
+
+
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1chttp/HttpSecretService.proto\x12/org.apache.airavata.mft.credential.service.http\x1a\x19http/HttpCredential.proto2\x89\x05\n\x11HTTPSecretService\x12\x8f\x01\n\rgetHTTPSecret\x12\x43.org.apache.airavata.mft.credential.stubs.http.HTTPSecretGetRequest\x1a\x39.org.apache.airavata.mft.credential.stubs.http.HTTPSecret\x12\x95\x01\n\x10\x63reateHTTPSecret\x12\x46.org.apache.airavata.mft.credential.stubs.http.HTTPSecretCreateRequ [...]
+
+
+
+_HTTPSECRETSERVICE = DESCRIPTOR.services_by_name['HTTPSecretService']
+if _descriptor._USE_C_DESCRIPTORS == False:
+
+ DESCRIPTOR._options = None
+ DESCRIPTOR._serialized_options = b'P\001'
+ _HTTPSECRETSERVICE._serialized_start=109
+ _HTTPSECRETSERVICE._serialized_end=758
+# @@protoc_insertion_point(module_scope)
diff --git a/python-sdk/src/airavata_mft_sdk/http/HttpSecretService_pb2_grpc.py b/python-sdk/src/airavata_mft_sdk/http/HttpSecretService_pb2_grpc.py
new file mode 100644
index 0000000..b21ef5d
--- /dev/null
+++ b/python-sdk/src/airavata_mft_sdk/http/HttpSecretService_pb2_grpc.py
@@ -0,0 +1,165 @@
+# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
+"""Client and server classes corresponding to protobuf-defined services."""
+import grpc
+
+from airavata_mft_sdk.http import HttpCredential_pb2 as http_dot_HttpCredential__pb2
+
+
+class HTTPSecretServiceStub(object):
+ """Missing associated documentation comment in .proto file."""
+
+ def __init__(self, channel):
+ """Constructor.
+
+ Args:
+ channel: A grpc.Channel.
+ """
+ self.getHTTPSecret = channel.unary_unary(
+ '/org.apache.airavata.mft.credential.service.http.HTTPSecretService/getHTTPSecret',
+ request_serializer=http_dot_HttpCredential__pb2.HTTPSecretGetRequest.SerializeToString,
+ response_deserializer=http_dot_HttpCredential__pb2.HTTPSecret.FromString,
+ )
+ self.createHTTPSecret = channel.unary_unary(
+ '/org.apache.airavata.mft.credential.service.http.HTTPSecretService/createHTTPSecret',
+ request_serializer=http_dot_HttpCredential__pb2.HTTPSecretCreateRequest.SerializeToString,
+ response_deserializer=http_dot_HttpCredential__pb2.HTTPSecret.FromString,
+ )
+ self.updateHTTPSecret = channel.unary_unary(
+ '/org.apache.airavata.mft.credential.service.http.HTTPSecretService/updateHTTPSecret',
+ request_serializer=http_dot_HttpCredential__pb2.HTTPSecretUpdateRequest.SerializeToString,
+ response_deserializer=http_dot_HttpCredential__pb2.HTTPSecretUpdateResponse.FromString,
+ )
+ self.deleteHTTPSecret = channel.unary_unary(
+ '/org.apache.airavata.mft.credential.service.http.HTTPSecretService/deleteHTTPSecret',
+ request_serializer=http_dot_HttpCredential__pb2.HTTPSecretDeleteRequest.SerializeToString,
+ response_deserializer=http_dot_HttpCredential__pb2.HTTPSecretDeleteResponse.FromString,
+ )
+
+
+class HTTPSecretServiceServicer(object):
+ """Missing associated documentation comment in .proto file."""
+
+ def getHTTPSecret(self, request, context):
+ """Missing associated documentation comment in .proto file."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def createHTTPSecret(self, request, context):
+ """Missing associated documentation comment in .proto file."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def updateHTTPSecret(self, request, context):
+ """Missing associated documentation comment in .proto file."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def deleteHTTPSecret(self, request, context):
+ """Missing associated documentation comment in .proto file."""
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+
+def add_HTTPSecretServiceServicer_to_server(servicer, server):
+ rpc_method_handlers = {
+ 'getHTTPSecret': grpc.unary_unary_rpc_method_handler(
+ servicer.getHTTPSecret,
+ request_deserializer=http_dot_HttpCredential__pb2.HTTPSecretGetRequest.FromString,
+ response_serializer=http_dot_HttpCredential__pb2.HTTPSecret.SerializeToString,
+ ),
+ 'createHTTPSecret': grpc.unary_unary_rpc_method_handler(
+ servicer.createHTTPSecret,
+ request_deserializer=http_dot_HttpCredential__pb2.HTTPSecretCreateRequest.FromString,
+ response_serializer=http_dot_HttpCredential__pb2.HTTPSecret.SerializeToString,
+ ),
+ 'updateHTTPSecret': grpc.unary_unary_rpc_method_handler(
+ servicer.updateHTTPSecret,
+ request_deserializer=http_dot_HttpCredential__pb2.HTTPSecretUpdateRequest.FromString,
+ response_serializer=http_dot_HttpCredential__pb2.HTTPSecretUpdateResponse.SerializeToString,
+ ),
+ 'deleteHTTPSecret': grpc.unary_unary_rpc_method_handler(
+ servicer.deleteHTTPSecret,
+ request_deserializer=http_dot_HttpCredential__pb2.HTTPSecretDeleteRequest.FromString,
+ response_serializer=http_dot_HttpCredential__pb2.HTTPSecretDeleteResponse.SerializeToString,
+ ),
+ }
+ generic_handler = grpc.method_handlers_generic_handler(
+ 'org.apache.airavata.mft.credential.service.http.HTTPSecretService', rpc_method_handlers)
+ server.add_generic_rpc_handlers((generic_handler,))
+
+
+ # This class is part of an EXPERIMENTAL API.
+class HTTPSecretService(object):
+ """Missing associated documentation comment in .proto file."""
+
+ @staticmethod
+ def getHTTPSecret(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/org.apache.airavata.mft.credential.service.http.HTTPSecretService/getHTTPSecret',
+ http_dot_HttpCredential__pb2.HTTPSecretGetRequest.SerializeToString,
+ http_dot_HttpCredential__pb2.HTTPSecret.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+ @staticmethod
+ def createHTTPSecret(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/org.apache.airavata.mft.credential.service.http.HTTPSecretService/createHTTPSecret',
+ http_dot_HttpCredential__pb2.HTTPSecretCreateRequest.SerializeToString,
+ http_dot_HttpCredential__pb2.HTTPSecret.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+ @staticmethod
+ def updateHTTPSecret(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/org.apache.airavata.mft.credential.service.http.HTTPSecretService/updateHTTPSecret',
+ http_dot_HttpCredential__pb2.HTTPSecretUpdateRequest.SerializeToString,
+ http_dot_HttpCredential__pb2.HTTPSecretUpdateResponse.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+ @staticmethod
+ def deleteHTTPSecret(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/org.apache.airavata.mft.credential.service.http.HTTPSecretService/deleteHTTPSecret',
+ http_dot_HttpCredential__pb2.HTTPSecretDeleteRequest.SerializeToString,
+ http_dot_HttpCredential__pb2.HTTPSecretDeleteResponse.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
diff --git a/python-sdk/src/airavata_mft_sdk/http/__init__.py b/python-sdk/src/airavata_mft_sdk/http/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/python-sdk/src/airavata_mft_sdk/mft_client.py b/python-sdk/src/airavata_mft_sdk/mft_client.py
index ca5c326..ef42a1c 100644
--- a/python-sdk/src/airavata_mft_sdk/mft_client.py
+++ b/python-sdk/src/airavata_mft_sdk/mft_client.py
@@ -9,6 +9,7 @@ from airavata_mft_sdk.local import LocalStorageService_pb2_grpc
from airavata_mft_sdk.s3 import S3StorageService_pb2_grpc
from airavata_mft_sdk.swift import SwiftStorageService_pb2_grpc
from airavata_mft_sdk.scp import SCPStorageService_pb2_grpc
+from airavata_mft_sdk.http import HTTPStorageService_pb2_grpc
from airavata_mft_sdk.common import StorageCommon_pb2_grpc
@@ -20,6 +21,7 @@ from airavata_mft_sdk.gcs import GCSSecretService_pb2_grpc
from airavata_mft_sdk.s3 import S3SecretService_pb2_grpc
from airavata_mft_sdk.swift import SwiftSecretService_pb2_grpc
from airavata_mft_sdk.scp import SCPSecretService_pb2_grpc
+from airavata_mft_sdk.http import HttpSecretService_pb2_grpc
class MFTClient:
@@ -50,6 +52,7 @@ class MFTClient:
self.s3_storage_api = S3StorageService_pb2_grpc.S3StorageServiceStub(self.resource_channel)
self.scp_storage_api = SCPStorageService_pb2_grpc.SCPStorageServiceStub(self.resource_channel)
self.swift_storage_api = SwiftStorageService_pb2_grpc.SwiftStorageServiceStub(self.resource_channel)
+ self.http_storage_api = HTTPStorageService_pb2_grpc.HTTPStorageServiceStub(self.resource_channel)
self.common_api = StorageCommon_pb2_grpc.StorageCommonServiceStub(self.resource_channel)
if (not secret_service_secured):
@@ -63,6 +66,7 @@ class MFTClient:
self.s3_secret_api = S3SecretService_pb2_grpc.S3SecretServiceStub(self.secret_channel)
self.swift_secret_api = SwiftSecretService_pb2_grpc.SwiftSecretServiceStub(self.secret_channel)
self.scp_secret_api = SCPSecretService_pb2_grpc.SCPSecretServiceStub(self.secret_channel)
+ self.http_secret_api = HttpSecretService_pb2_grpc.HTTPSecretServiceStub(self.secret_channel)
diff --git a/services/resource-service/client/src/main/java/org/apache/airavata/mft/resource/client/StorageServiceClient.java b/services/resource-service/client/src/main/java/org/apache/airavata/mft/resource/client/StorageServiceClient.java
index 7f1ee7f..c25daab 100644
--- a/services/resource-service/client/src/main/java/org/apache/airavata/mft/resource/client/StorageServiceClient.java
+++ b/services/resource-service/client/src/main/java/org/apache/airavata/mft/resource/client/StorageServiceClient.java
@@ -23,6 +23,7 @@ import org.apache.airavata.mft.resource.service.box.BoxStorageServiceGrpc;
import org.apache.airavata.mft.resource.service.dropbox.DropboxStorageServiceGrpc;
import org.apache.airavata.mft.resource.service.ftp.FTPStorageServiceGrpc;
import org.apache.airavata.mft.resource.service.gcs.GCSStorageServiceGrpc;
+import org.apache.airavata.mft.resource.service.http.HTTPStorageServiceGrpc;
import org.apache.airavata.mft.resource.service.local.LocalStorageServiceGrpc;
import org.apache.airavata.mft.resource.service.odata.ODataStorageServiceGrpc;
import org.apache.airavata.mft.resource.service.s3.S3StorageServiceGrpc;
@@ -81,6 +82,10 @@ public class StorageServiceClient implements Closeable {
return ODataStorageServiceGrpc.newBlockingStub(channel);
}
+ public HTTPStorageServiceGrpc.HTTPStorageServiceBlockingStub http() {
+ return HTTPStorageServiceGrpc.newBlockingStub(channel);
+ }
+
public StorageCommonServiceGrpc.StorageCommonServiceBlockingStub common() {
return StorageCommonServiceGrpc.newBlockingStub(channel);
}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/ResourceBackend.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/ResourceBackend.java
index 8664f03..7476529 100644
--- a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/ResourceBackend.java
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/ResourceBackend.java
@@ -22,6 +22,7 @@ import org.apache.airavata.mft.resource.stubs.box.storage.*;
import org.apache.airavata.mft.resource.stubs.dropbox.storage.*;
import org.apache.airavata.mft.resource.stubs.ftp.storage.*;
import org.apache.airavata.mft.resource.stubs.gcs.storage.*;
+import org.apache.airavata.mft.resource.stubs.http.storage.*;
import org.apache.airavata.mft.resource.stubs.local.storage.*;
import org.apache.airavata.mft.resource.stubs.odata.storage.*;
import org.apache.airavata.mft.resource.stubs.s3.storage.*;
@@ -100,5 +101,12 @@ public interface ResourceBackend {
boolean updateODataStorage(ODataStorageUpdateRequest request) throws Exception;
boolean deleteODataStorage(ODataStorageDeleteRequest request) throws Exception;
+ public HTTPStorageListResponse listHttpStorage(HTTPStorageListRequest request) throws Exception;
+ Optional<HTTPStorage> getHttpStorage(HTTPStorageGetRequest request) throws Exception;
+ HTTPStorage createHttpStorage(HTTPStorageCreateRequest request) throws Exception;
+ boolean updateHttpStorage(HTTPStorageUpdateRequest request) throws Exception;
+ boolean deleteHttpStorage(HTTPStorageDeleteRequest request) throws Exception;
+
StorageTypeResolveResponse resolveStorageType(StorageTypeResolveRequest request) throws Exception;
+
}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java
index 5d5e580..4751130 100644
--- a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java
@@ -25,6 +25,7 @@ import org.apache.airavata.mft.resource.stubs.box.storage.*;
import org.apache.airavata.mft.resource.stubs.dropbox.storage.*;
import org.apache.airavata.mft.resource.stubs.ftp.storage.*;
import org.apache.airavata.mft.resource.stubs.gcs.storage.*;
+import org.apache.airavata.mft.resource.stubs.http.storage.*;
import org.apache.airavata.mft.resource.stubs.local.storage.*;
import org.apache.airavata.mft.resource.stubs.odata.storage.*;
import org.apache.airavata.mft.resource.stubs.s3.storage.*;
@@ -78,6 +79,9 @@ public class SQLResourceBackend implements ResourceBackend {
@Autowired
private ODataStorageRepository odataStorageRepository;
+ @Autowired
+ private HttpStorageRepository httpStorageRepository;
+
@Autowired
private ResolveStorageRepository resolveStorageRepository;
@@ -542,7 +546,47 @@ public class SQLResourceBackend implements ResourceBackend {
@Override
public boolean deleteODataStorage(ODataStorageDeleteRequest request) throws Exception {
odataStorageRepository.deleteById(request.getStorageId());
- resourceRepository.deleteByStorageIdAndStorageType(request.getStorageId(), GenericResourceEntity.StorageType.SWIFT);
+ resourceRepository.deleteByStorageIdAndStorageType(request.getStorageId(), GenericResourceEntity.StorageType.ODATA);
+ return true;
+ }
+
+ @Override
+ public HTTPStorageListResponse listHttpStorage(HTTPStorageListRequest request) throws Exception {
+ HTTPStorageListResponse.Builder respBuilder = HTTPStorageListResponse.newBuilder();
+ List<HttpStorageEntity> all = httpStorageRepository.findAll(PageRequest.of(request.getOffset(), request.getLimit()));
+ all.forEach(ety -> respBuilder.addStorages(mapper.map(ety, HTTPStorage.newBuilder().getClass())));
+ return respBuilder.build();
+ }
+
+ @Override
+ public Optional<HTTPStorage> getHttpStorage(HTTPStorageGetRequest request) throws Exception {
+ Optional<HttpStorageEntity> entity = httpStorageRepository.findById(request.getStorageId());
+ return entity.map(e -> mapper.map(e, HTTPStorage.newBuilder().getClass()).build());
+ }
+
+ @Override
+ public HTTPStorage createHttpStorage(HTTPStorageCreateRequest request) throws Exception {
+ HttpStorageEntity savedEntity = httpStorageRepository.save(mapper.map(request, HttpStorageEntity.class));
+
+ ResolveStorageEntity storageTypeEty = new ResolveStorageEntity();
+ storageTypeEty.setStorageId(savedEntity.getStorageId());
+ storageTypeEty.setStorageType(ResolveStorageEntity.StorageType.HTTP);
+ storageTypeEty.setStorageName(savedEntity.getName());
+ resolveStorageRepository.save(storageTypeEty);
+
+ return mapper.map(savedEntity, HTTPStorage.newBuilder().getClass()).build();
+ }
+
+ @Override
+ public boolean updateHttpStorage(HTTPStorageUpdateRequest request) throws Exception {
+ httpStorageRepository.save(mapper.map(request, HttpStorageEntity.class));
+ return true;
+ }
+
+ @Override
+ public boolean deleteHttpStorage(HTTPStorageDeleteRequest request) throws Exception {
+ httpStorageRepository.deleteById(request.getStorageId());
+ resourceRepository.deleteByStorageIdAndStorageType(request.getStorageId(), GenericResourceEntity.StorageType.HTTP);
return true;
}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/GenericResourceEntity.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/GenericResourceEntity.java
index daafa6d..619e900 100644
--- a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/GenericResourceEntity.java
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/GenericResourceEntity.java
@@ -32,7 +32,7 @@ public class GenericResourceEntity {
}
public enum StorageType {
- S3, SCP, LOCAL, FTP, BOX, DROPBOX, GCS, AZURE, SWIFT, ODATA;
+ S3, SCP, LOCAL, FTP, BOX, DROPBOX, GCS, AZURE, SWIFT, ODATA, HTTP;
}
@Id
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/HttpStorageEntity.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/HttpStorageEntity.java
new file mode 100644
index 0000000..e824bf0
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/HttpStorageEntity.java
@@ -0,0 +1,48 @@
+package org.apache.airavata.mft.resource.server.backend.sql.entity;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class HttpStorageEntity {
+
+ @Id
+ @Column(name = "HTTP_STORAGE_ID")
+ @GeneratedValue(generator = "uuid")
+ @GenericGenerator( name = "uuid", strategy = "uuid2")
+ private String storageId;
+
+ @Column(name = "NAME")
+ private String name;
+
+ @Column(name = "BASE_URL")
+ private String baseUrl;
+
+ public String getStorageId() {
+ return storageId;
+ }
+
+ public void setStorageId(String storageId) {
+ this.storageId = storageId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+
+ public void setBaseUrl(String baseUrl) {
+ this.baseUrl = baseUrl;
+ }
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/ResolveStorageEntity.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/ResolveStorageEntity.java
index e43281d..6322052 100644
--- a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/ResolveStorageEntity.java
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/ResolveStorageEntity.java
@@ -28,7 +28,7 @@ import javax.persistence.Id;
public class ResolveStorageEntity {
public enum StorageType {
- S3, SCP, LOCAL, FTP, BOX, DROPBOX, GCS, AZURE, SWIFT, ODATA;
+ S3, SCP, LOCAL, FTP, BOX, DROPBOX, GCS, AZURE, SWIFT, ODATA,HTTP;
}
@Id
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/HttpStorageRepository.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/HttpStorageRepository.java
new file mode 100644
index 0000000..923c9f1
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/HttpStorageRepository.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.airavata.mft.resource.server.backend.sql.repository;
+
+import org.apache.airavata.mft.resource.server.backend.sql.entity.HttpStorageEntity;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface HttpStorageRepository extends CrudRepository<HttpStorageEntity, String> {
+ List<HttpStorageEntity> findAll(Pageable pageable);
+}
diff --git a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/handler/HttpServiceHandler.java b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/handler/HttpServiceHandler.java
new file mode 100644
index 0000000..b582974
--- /dev/null
+++ b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/handler/HttpServiceHandler.java
@@ -0,0 +1,107 @@
+package org.apache.airavata.mft.resource.server.handler;
+
+import io.grpc.Status;
+import io.grpc.stub.StreamObserver;
+import org.apache.airavata.mft.resource.server.backend.ResourceBackend;
+import org.apache.airavata.mft.resource.service.http.HTTPStorageServiceGrpc;
+import org.apache.airavata.mft.resource.stubs.http.storage.*;
+import org.lognet.springboot.grpc.GRpcService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+@Service("RSHTTPServiceHandler")
+@GRpcService
+public class HttpServiceHandler extends HTTPStorageServiceGrpc.HTTPStorageServiceImplBase {
+
+ private static final Logger logger = LoggerFactory.getLogger(HttpServiceHandler.class);
+
+ @Autowired
+ @Qualifier("SQLResourceBackend")
+ private ResourceBackend backend;
+
+ @Override
+ public void listHTTPStorage(HTTPStorageListRequest request, StreamObserver<HTTPStorageListResponse> responseObserver) {
+ try {
+ HTTPStorageListResponse response = this.backend.listHttpStorage(request);
+ responseObserver.onNext(response);
+ responseObserver.onCompleted();
+ } catch (Exception e) {
+ logger.error("Failed in retrieving HTTP storage list", e);
+
+ responseObserver.onError(Status.INTERNAL.withCause(e)
+ .withDescription("Failed in retrieving HTTP storage list")
+ .asRuntimeException());
+ }
+ }
+
+ @Override
+ public void getHTTPStorage(HTTPStorageGetRequest request, StreamObserver<HTTPStorage> responseObserver) {
+ try {
+ this.backend.getHttpStorage(request).ifPresentOrElse(resource -> {
+ responseObserver.onNext(resource);
+ responseObserver.onCompleted();
+ }, () -> {
+ responseObserver.onError(Status.INTERNAL
+ .withDescription("No HTTP storage with id " + request.getStorageId())
+ .asRuntimeException());
+ });
+ } catch (Exception e) {
+ logger.error("Failed in retrieving HTTP storage with id {}", request.getStorageId(), e);
+
+ responseObserver.onError(Status.INTERNAL.withCause(e)
+ .withDescription("Failed in retrieving HTTP storage with id " + request.getStorageId())
+ .asRuntimeException());
+ }
+ }
+
+ @Override
+ public void createHTTPStorage(HTTPStorageCreateRequest request, StreamObserver<HTTPStorage> responseObserver) {
+ try {
+ responseObserver.onNext(this.backend.createHttpStorage(request));
+ responseObserver.onCompleted();
+ } catch (Exception e) {
+ logger.error("Failed in creating the HTTP storage", e);
+
+ responseObserver.onError(Status.INTERNAL.withCause(e)
+ .withDescription("Failed in creating the HTTP storage")
+ .asRuntimeException());
+ }
+ }
+
+ @Override
+ public void updateHTTPStorage(HTTPStorageUpdateRequest request, StreamObserver<HTTPStorageUpdateResponse> responseObserver) {
+ try {
+ this.backend.updateHttpStorage(request);
+ responseObserver.onNext(HTTPStorageUpdateResponse.newBuilder().setStorageId(request.getStorageId()).build());
+ responseObserver.onCompleted();
+ } catch (Exception e) {
+ logger.error("Failed in updating the HTTP storage {}", request.getStorageId(), e);
+
+ responseObserver.onError(Status.INTERNAL.withCause(e)
+ .withDescription("Failed in updating the HTTP storage with id " + request.getStorageId())
+ .asRuntimeException());
+ }
+ }
+
+ @Override
+ public void deleteHTTPStorage(HTTPStorageDeleteRequest request, StreamObserver<HTTPStorageDeleteResponse> responseObserver) {
+ try {
+ boolean res = this.backend.deleteHttpStorage(request);
+ if (res) {
+ responseObserver.onNext(HTTPStorageDeleteResponse.newBuilder().setStatus(true).build());
+ responseObserver.onCompleted();
+ } else {
+ responseObserver.onError(new Exception("Failed to delete HTTP storage with id " + request.getStorageId()));
+ }
+ } catch (Exception e) {
+ logger.error("Failed in deleting the HTTP storage {}", request.getStorageId(), e);
+
+ responseObserver.onError(Status.INTERNAL.withCause(e)
+ .withDescription("Failed in deleting the HTTP storage with id " + request.getStorageId())
+ .asRuntimeException());
+ }
+ }
+}
diff --git a/services/resource-service/stub/src/main/proto/common/StorageCommon.proto b/services/resource-service/stub/src/main/proto/common/StorageCommon.proto
index 3f62f6d..4119651 100644
--- a/services/resource-service/stub/src/main/proto/common/StorageCommon.proto
+++ b/services/resource-service/stub/src/main/proto/common/StorageCommon.proto
@@ -31,6 +31,7 @@ enum StorageType {
AZURE = 7;
SWIFT = 8;
ODATA = 9;
+ HTTP = 10;
}
enum Error {
diff --git a/services/resource-service/stub/src/main/proto/http/HTTPStorage.proto b/services/resource-service/stub/src/main/proto/http/HTTPStorage.proto
new file mode 100644
index 0000000..fc0ae34
--- /dev/null
+++ b/services/resource-service/stub/src/main/proto/http/HTTPStorage.proto
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+option java_multiple_files = true;
+package org.apache.airavata.mft.resource.stubs.http.storage;
+
+message HTTPStorage {
+ string storageId = 1;
+ string name = 2;
+ string baseUrl = 3;
+}
+
+message HTTPStorageListRequest {
+ int32 offset = 1;
+ int32 limit = 2;
+}
+
+message HTTPStorageListResponse {
+ repeated HTTPStorage storages = 1;
+}
+
+message HTTPStorageGetRequest {
+ string storageId = 1;
+}
+
+message HTTPStorageCreateRequest {
+ string name = 1;
+ string baseUrl = 2;
+}
+
+message HTTPStorageUpdateRequest {
+ string storageId = 1;
+ string name = 2;
+ string baseUrl = 3;
+}
+
+message HTTPStorageUpdateResponse {
+ string storageId = 1;
+}
+
+
+message HTTPStorageDeleteRequest {
+ string storageId = 1;
+}
+
+message HTTPStorageDeleteResponse {
+ bool status = 1;
+}
+
+
diff --git a/services/resource-service/stub/src/main/proto/http/HTTPStorageService.proto b/services/resource-service/stub/src/main/proto/http/HTTPStorageService.proto
new file mode 100644
index 0000000..a5f521a
--- /dev/null
+++ b/services/resource-service/stub/src/main/proto/http/HTTPStorageService.proto
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+option java_multiple_files = true;
+package org.apache.airavata.mft.resource.service.http;
+
+import "http/HTTPStorage.proto";
+
+service HTTPStorageService {
+
+ // Storage
+ rpc listHTTPStorage (org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageListRequest) returns
+ (org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageListResponse);
+
+ rpc getHTTPStorage (org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageGetRequest) returns
+ (org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorage);
+
+ rpc createHTTPStorage (org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageCreateRequest) returns
+ (org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorage);
+
+ rpc updateHTTPStorage (org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageUpdateRequest) returns
+ (org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageUpdateResponse);
+
+ rpc deleteHTTPStorage (org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageDeleteRequest) returns
+ (org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorageDeleteResponse);
+}
\ No newline at end of file
diff --git a/services/secret-service/client/src/main/java/org/apache/airavata/mft/secret/client/SecretServiceClient.java b/services/secret-service/client/src/main/java/org/apache/airavata/mft/secret/client/SecretServiceClient.java
index e686d54..0e8bdc7 100644
--- a/services/secret-service/client/src/main/java/org/apache/airavata/mft/secret/client/SecretServiceClient.java
+++ b/services/secret-service/client/src/main/java/org/apache/airavata/mft/secret/client/SecretServiceClient.java
@@ -23,6 +23,7 @@ import org.apache.airavata.mft.credential.service.box.BoxSecretServiceGrpc;
import org.apache.airavata.mft.credential.service.dropbox.DropboxSecretServiceGrpc;
import org.apache.airavata.mft.credential.service.ftp.FTPSecretServiceGrpc;
import org.apache.airavata.mft.credential.service.gcs.GCSSecretServiceGrpc;
+import org.apache.airavata.mft.credential.service.http.HTTPSecretServiceGrpc;
import org.apache.airavata.mft.credential.service.odata.ODataSecretServiceGrpc;
import org.apache.airavata.mft.credential.service.s3.S3SecretServiceGrpc;
import org.apache.airavata.mft.credential.service.scp.SCPSecretServiceGrpc;
@@ -75,6 +76,10 @@ public class SecretServiceClient implements Closeable {
return ODataSecretServiceGrpc.newBlockingStub(channel);
}
+ public HTTPSecretServiceGrpc.HTTPSecretServiceBlockingStub http() {
+ return HTTPSecretServiceGrpc.newBlockingStub(channel);
+ }
+
@Override
public void close() throws IOException {
this.channel.shutdown();
diff --git a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/SecretBackend.java b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/SecretBackend.java
index 2fbdb31..849e959 100644
--- a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/SecretBackend.java
+++ b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/SecretBackend.java
@@ -22,6 +22,7 @@ import org.apache.airavata.mft.credential.stubs.box.*;
import org.apache.airavata.mft.credential.stubs.dropbox.*;
import org.apache.airavata.mft.credential.stubs.ftp.*;
import org.apache.airavata.mft.credential.stubs.gcs.*;
+import org.apache.airavata.mft.credential.stubs.http.*;
import org.apache.airavata.mft.credential.stubs.odata.*;
import org.apache.airavata.mft.credential.stubs.s3.*;
import org.apache.airavata.mft.credential.stubs.scp.*;
@@ -78,4 +79,9 @@ public interface SecretBackend {
ODataSecret createODataSecret(ODataSecretCreateRequest request) throws Exception;
boolean updateODataSecret(ODataSecretUpdateRequest request) throws Exception;
boolean deleteODataSecret(ODataSecretDeleteRequest request) throws Exception;
+
+ Optional<HTTPSecret> getHttpSecret(HTTPSecretGetRequest request) throws Exception;
+ HTTPSecret createHttpSecret(HTTPSecretCreateRequest request) throws Exception;
+ boolean updateHttpSecret(HTTPSecretUpdateRequest request) throws Exception;
+ boolean deleteHttpSecret(HTTPSecretDeleteRequest request) throws Exception;
}
diff --git a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/SQLSecretBackend.java b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/SQLSecretBackend.java
index 2c08b98..c323b87 100644
--- a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/SQLSecretBackend.java
+++ b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/SQLSecretBackend.java
@@ -22,17 +22,24 @@ import org.apache.airavata.mft.credential.stubs.box.*;
import org.apache.airavata.mft.credential.stubs.dropbox.*;
import org.apache.airavata.mft.credential.stubs.ftp.*;
import org.apache.airavata.mft.credential.stubs.gcs.*;
+import org.apache.airavata.mft.credential.stubs.http.*;
import org.apache.airavata.mft.credential.stubs.odata.*;
import org.apache.airavata.mft.credential.stubs.s3.*;
import org.apache.airavata.mft.credential.stubs.scp.*;
import org.apache.airavata.mft.credential.stubs.swift.*;
import org.apache.airavata.mft.secret.server.backend.SecretBackend;
import org.apache.airavata.mft.secret.server.backend.sql.entity.*;
+import org.apache.airavata.mft.secret.server.backend.sql.entity.http.BasicAuthSecretEntity;
+import org.apache.airavata.mft.secret.server.backend.sql.entity.http.HttpSecretEntity;
+import org.apache.airavata.mft.secret.server.backend.sql.entity.http.TokenAuthSecretEntity;
import org.apache.airavata.mft.secret.server.backend.sql.entity.swift.SwiftSecretEntity.InternalSecretType;
import org.apache.airavata.mft.secret.server.backend.sql.entity.swift.SwiftV2AuthSecretEntity;
import org.apache.airavata.mft.secret.server.backend.sql.entity.swift.SwiftV3AuthSecretEntity;
import org.apache.airavata.mft.secret.server.backend.sql.entity.swift.SwiftSecretEntity;
import org.apache.airavata.mft.secret.server.backend.sql.repository.*;
+import org.apache.airavata.mft.secret.server.backend.sql.repository.http.BasicAuthSecretRepository;
+import org.apache.airavata.mft.secret.server.backend.sql.repository.http.HttpSecretRepository;
+import org.apache.airavata.mft.secret.server.backend.sql.repository.http.TokenAuthSecretRepository;
import org.apache.airavata.mft.secret.server.backend.sql.repository.swift.SwiftV2AuthSecretRepository;
import org.apache.airavata.mft.secret.server.backend.sql.repository.swift.SwiftV3AuthSecretRepository;
import org.apache.airavata.mft.secret.server.backend.sql.repository.swift.SwiftSecretRepository;
@@ -76,6 +83,15 @@ public class SQLSecretBackend implements SecretBackend {
@Autowired
private GCSSecretRepository gcsSecretRepository;
+ @Autowired
+ private HttpSecretRepository httpSecretRepository;
+
+ @Autowired
+ private BasicAuthSecretRepository basicAuthSecretRepository;
+
+ @Autowired
+ private TokenAuthSecretRepository tokenAuthSecretRepository;
+
private DozerBeanMapper mapper = new DozerBeanMapper();
@Override
@@ -375,4 +391,105 @@ public class SQLSecretBackend implements SecretBackend {
odataSecretRepository.deleteById(request.getSecretId());
return true;
}
+
+ @Override
+ public Optional<HTTPSecret> getHttpSecret(HTTPSecretGetRequest request) throws Exception {
+ Optional<HttpSecretEntity> secEtyOp = httpSecretRepository.findBySecretId(request.getSecretId());
+ if (secEtyOp.isPresent()) {
+ HTTPSecret.Builder secBuilder = HTTPSecret.newBuilder();
+ HttpSecretEntity secEty = secEtyOp.get();
+ secBuilder.setSecretId(secEty.getSecretId());
+
+ switch (secEty.getInternalSecretType()) {
+ case BASIC:
+ Optional<BasicAuthSecretEntity> basicSec = basicAuthSecretRepository
+ .findBySecretId(secEty.getInternalSecretId());
+ if (basicSec.isPresent()) {
+ BasicAuth.Builder baBuilder = BasicAuth.newBuilder();
+ mapper.map(basicSec.get(), baBuilder);
+ secBuilder.setBasic(baBuilder.build());
+ } else {
+ throw new Exception("Can not find a swift password secret with id " + secEty.getInternalSecretId());
+ }
+ break;
+ case TOKEN:
+ Optional<TokenAuthSecretEntity> tokenSec = tokenAuthSecretRepository
+ .findBySecretId(secEty.getInternalSecretId());
+ if (tokenSec.isPresent()) {
+ TokenAuth.Builder tBuilder = TokenAuth.newBuilder();
+ mapper.map(tokenSec.get(), tBuilder);
+ secBuilder.setToken(tBuilder.build());
+ } else {
+ throw new Exception("Can not find a swift auth cred secret with id " + secEty.getInternalSecretId());
+ }
+ break;
+ default:
+ throw new Exception("Non compatible internal secret type : " + secEty.getInternalSecretType());
+ }
+ return Optional.of(secBuilder.build());
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ @Override
+ public HTTPSecret createHttpSecret(HTTPSecretCreateRequest request) throws Exception {
+ HttpSecretEntity secEty = new HttpSecretEntity();
+ BasicAuthSecretEntity baSecSaved = null;
+ TokenAuthSecretEntity tSecSaved = null;
+
+ switch (request.getSecret().getAuthCase()) {
+ case BASIC:
+ baSecSaved = basicAuthSecretRepository
+ .save(mapper.map(request.getSecret().getBasic(), BasicAuthSecretEntity.class));
+ secEty.setInternalSecretId(baSecSaved.getSecretId());
+ secEty.setInternalSecretType(HttpSecretEntity.InternalSecretType.BASIC);
+ break;
+ case TOKEN:
+ tSecSaved = tokenAuthSecretRepository
+ .save(mapper.map(request.getSecret().getToken(), TokenAuthSecretEntity.class));
+ secEty.setInternalSecretId(tSecSaved.getSecretId());
+ secEty.setInternalSecretType(HttpSecretEntity.InternalSecretType.TOKEN);
+ break;
+ case AUTH_NOT_SET:
+ throw new Exception("No internal secret auth is set");
+ }
+
+ HttpSecretEntity savedEty = httpSecretRepository.save(secEty);
+ HTTPSecret.Builder secBuilder = HTTPSecret.newBuilder();
+ secBuilder.setSecretId(savedEty.getSecretId());
+ switch (savedEty.getInternalSecretType()) {
+ case BASIC:
+ secBuilder.setBasic(mapper.map(baSecSaved, BasicAuth.newBuilder().getClass()));
+ break;
+ case TOKEN:
+ secBuilder.setToken(mapper.map(tSecSaved, TokenAuth.newBuilder().getClass()));
+ break;
+ }
+ return secBuilder.build();
+ }
+
+ @Override
+ public boolean updateHttpSecret(HTTPSecretUpdateRequest request) throws Exception {
+ return false;
+ }
+
+ @Override
+ public boolean deleteHttpSecret(HTTPSecretDeleteRequest request) throws Exception {
+ Optional<HttpSecretEntity> secOp = httpSecretRepository.findBySecretId(request.getSecretId());
+ if (secOp.isPresent()) {
+ httpSecretRepository.deleteById(request.getSecretId());
+ switch (secOp.get().getInternalSecretType()) {
+ case BASIC:
+ basicAuthSecretRepository.deleteById(secOp.get().getInternalSecretId());
+ break;
+ case TOKEN:
+ tokenAuthSecretRepository.deleteById(secOp.get().getInternalSecretId());
+ break;
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
}
diff --git a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/entity/http/BasicAuthSecretEntity.java b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/entity/http/BasicAuthSecretEntity.java
new file mode 100644
index 0000000..0ada572
--- /dev/null
+++ b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/entity/http/BasicAuthSecretEntity.java
@@ -0,0 +1,48 @@
+package org.apache.airavata.mft.secret.server.backend.sql.entity.http;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class BasicAuthSecretEntity {
+
+ @Id
+ @Column(name = "SECRET_ID")
+ @GeneratedValue(generator = "uuid")
+ @GenericGenerator(name = "uuid", strategy = "uuid2")
+ private String secretId;
+
+ @Column(name = "USERNAME")
+ String userName;
+
+ @Column(name = "PASSWORD")
+ String password;
+
+ public String getSecretId() {
+ return secretId;
+ }
+
+ public void setSecretId(String secretId) {
+ this.secretId = secretId;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+}
diff --git a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/entity/http/HttpSecretEntity.java b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/entity/http/HttpSecretEntity.java
new file mode 100644
index 0000000..3219a31
--- /dev/null
+++ b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/entity/http/HttpSecretEntity.java
@@ -0,0 +1,51 @@
+package org.apache.airavata.mft.secret.server.backend.sql.entity.http;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class HttpSecretEntity {
+ @Id
+ @Column(name = "SECRET_ID")
+ @GeneratedValue(generator = "uuid")
+ @GenericGenerator(name = "uuid", strategy = "uuid2")
+ private String secretId;
+
+ public enum InternalSecretType {
+ BASIC, TOKEN;
+ }
+
+ @Column(name = "INTERNAL_SECRET_ID")
+ private String internalSecretId;
+
+ @Column(name = "INTERNAL_SECRET_TYPE")
+ private HttpSecretEntity.InternalSecretType internalSecretType;
+
+ public String getSecretId() {
+ return secretId;
+ }
+
+ public void setSecretId(String secretId) {
+ this.secretId = secretId;
+ }
+
+ public String getInternalSecretId() {
+ return internalSecretId;
+ }
+
+ public void setInternalSecretId(String internalSecretId) {
+ this.internalSecretId = internalSecretId;
+ }
+
+ public InternalSecretType getInternalSecretType() {
+ return internalSecretType;
+ }
+
+ public void setInternalSecretType(InternalSecretType internalSecretType) {
+ this.internalSecretType = internalSecretType;
+ }
+}
diff --git a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/entity/http/TokenAuthSecretEntity.java b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/entity/http/TokenAuthSecretEntity.java
new file mode 100644
index 0000000..21d73c1
--- /dev/null
+++ b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/entity/http/TokenAuthSecretEntity.java
@@ -0,0 +1,36 @@
+package org.apache.airavata.mft.secret.server.backend.sql.entity.http;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+
+@Entity
+public class TokenAuthSecretEntity {
+
+ @Id
+ @Column(name = "SECRET_ID")
+ @GeneratedValue(generator = "uuid")
+ @GenericGenerator(name = "uuid", strategy = "uuid2")
+ private String secretId;
+
+
+ @Lob
+ @Column(name = "ACCESS_TOKEN", columnDefinition = "TEXT")
+ String accessToken;
+
+ public String getSecretId() {
+ return secretId;
+ }
+
+ public void setSecretId(String secretId) {
+ this.secretId = secretId;
+ }
+
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ public void setAccessToken(String accessToken) {
+ this.accessToken = accessToken;
+ }
+}
diff --git a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/repository/http/BasicAuthSecretRepository.java b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/repository/http/BasicAuthSecretRepository.java
new file mode 100644
index 0000000..fbdd9af
--- /dev/null
+++ b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/repository/http/BasicAuthSecretRepository.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.airavata.mft.secret.server.backend.sql.repository.http;
+
+import org.apache.airavata.mft.secret.server.backend.sql.entity.http.BasicAuthSecretEntity;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+public interface BasicAuthSecretRepository extends CrudRepository<BasicAuthSecretEntity, String> {
+ Optional<BasicAuthSecretEntity> findBySecretId(String secretId);
+
+}
diff --git a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/repository/http/HttpSecretRepository.java b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/repository/http/HttpSecretRepository.java
new file mode 100644
index 0000000..60a9b2a
--- /dev/null
+++ b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/repository/http/HttpSecretRepository.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.airavata.mft.secret.server.backend.sql.repository.http;
+
+import org.apache.airavata.mft.secret.server.backend.sql.entity.http.HttpSecretEntity;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+public interface HttpSecretRepository extends CrudRepository<HttpSecretEntity, String> {
+ Optional<HttpSecretEntity> findBySecretId(String secretId);
+}
diff --git a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/repository/http/TokenAuthSecretRepository.java b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/repository/http/TokenAuthSecretRepository.java
new file mode 100644
index 0000000..2f85e99
--- /dev/null
+++ b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/backend/sql/repository/http/TokenAuthSecretRepository.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.airavata.mft.secret.server.backend.sql.repository.http;
+
+import org.apache.airavata.mft.secret.server.backend.sql.entity.http.TokenAuthSecretEntity;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.Optional;
+
+public interface TokenAuthSecretRepository extends CrudRepository<TokenAuthSecretEntity, String> {
+ Optional<TokenAuthSecretEntity> findBySecretId(String secretId);
+}
diff --git a/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/handler/HttpServiceHandler.java b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/handler/HttpServiceHandler.java
new file mode 100644
index 0000000..7e41a3b
--- /dev/null
+++ b/services/secret-service/server/src/main/java/org/apache/airavata/mft/secret/server/handler/HttpServiceHandler.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.airavata.mft.secret.server.handler;
+
+import io.grpc.Status;
+import io.grpc.stub.StreamObserver;
+import org.apache.airavata.mft.credential.service.http.HTTPSecretServiceGrpc;
+import org.apache.airavata.mft.credential.stubs.http.*;
+import org.apache.airavata.mft.secret.server.backend.SecretBackend;
+import org.lognet.springboot.grpc.GRpcService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+@Service("SSHTTPServiceHandler")
+@GRpcService
+public class HttpServiceHandler extends HTTPSecretServiceGrpc.HTTPSecretServiceImplBase {
+
+ private static final Logger logger = LoggerFactory.getLogger(HttpServiceHandler.class);
+
+ @Autowired
+ @Qualifier("SQLSecretBackend")
+ private SecretBackend backend;
+
+ @Override
+ public void getHTTPSecret(HTTPSecretGetRequest request, StreamObserver<HTTPSecret> responseObserver) {
+ try {
+ this.backend.getHttpSecret(request).ifPresentOrElse(secret -> {
+ responseObserver.onNext(secret);
+ responseObserver.onCompleted();
+ }, () -> {
+ responseObserver.onError(Status.INTERNAL
+ .withDescription("No HTTP Secret with id " + request.getSecretId())
+ .asRuntimeException());
+ });
+
+ } catch (Exception e) {
+ logger.error("Error in retrieving HTTP Secret with id " + request.getSecretId(), e);
+ responseObserver.onError(Status.INTERNAL.withCause(e)
+ .withDescription("Error in retrieving HTTP Secret with id " + request.getSecretId())
+ .asRuntimeException());
+ }
+ }
+
+ @Override
+ public void createHTTPSecret(HTTPSecretCreateRequest request, StreamObserver<HTTPSecret> responseObserver) {
+ try {
+ HTTPSecret httpSecret = this.backend.createHttpSecret(request);
+ responseObserver.onNext(httpSecret);
+ responseObserver.onCompleted();
+ } catch (Exception e) {
+ logger.error("Error in creating HTTP Secret", e);
+ responseObserver.onError(Status.INTERNAL.withCause(e)
+ .withDescription("Error in creating HTTP Secret")
+ .asRuntimeException());
+ }
+ }
+
+ @Override
+ public void updateHTTPSecret(HTTPSecretUpdateRequest request, StreamObserver<HTTPSecretUpdateResponse> responseObserver) {
+ try {
+ this.backend.updateHttpSecret(request);
+ responseObserver.onNext(HTTPSecretUpdateResponse.newBuilder().setSecretId(request.getSecret().getSecretId()).build());
+ responseObserver.onCompleted();
+ } catch (Exception e) {
+ logger.error("Error in updating HTTP Secret with id {}", request.getSecret().getSecretId(), e);
+ responseObserver.onError(Status.INTERNAL.withCause(e)
+ .withDescription("Error in updating HTTP Secret with id " + request.getSecret().getSecretId())
+ .asRuntimeException());
+ }
+ }
+
+ @Override
+ public void deleteHTTPSecret(HTTPSecretDeleteRequest request, StreamObserver<HTTPSecretDeleteResponse> responseObserver) {
+ try {
+ this.backend.deleteHttpSecret(request);
+ responseObserver.onNext(HTTPSecretDeleteResponse.newBuilder().setStatus(true).build());
+ responseObserver.onCompleted();
+ } catch (Exception e) {
+ logger.error("Error in deleting HTTP Secret with id {}", request.getSecretId(), e);
+ responseObserver.onError(Status.INTERNAL.withCause(e)
+ .withDescription("Error in deleting HTTP Secret with id " + request.getSecretId())
+ .asRuntimeException());
+ }
+ }
+}
diff --git a/services/secret-service/stub/src/main/proto/http/HttpCredential.proto b/services/secret-service/stub/src/main/proto/http/HttpCredential.proto
new file mode 100644
index 0000000..fb74ccc
--- /dev/null
+++ b/services/secret-service/stub/src/main/proto/http/HttpCredential.proto
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+option java_multiple_files = true;
+package org.apache.airavata.mft.credential.stubs.http;
+
+import "CredCommon.proto";
+
+message BasicAuth {
+ string userName = 1;
+ string password = 2;
+}
+
+message TokenAuth {
+ string accessToken = 3;
+}
+
+message HTTPSecret {
+ string secretId = 1;
+ oneof auth {
+ BasicAuth basic = 2;
+ TokenAuth token = 3;
+ }
+}
+
+message HTTPSecretGetRequest {
+ string secretId = 1;
+ org.apache.airavata.mft.common.AuthToken authzToken = 2;
+}
+
+message HTTPSecretCreateRequest {
+ HTTPSecret secret = 1;
+ org.apache.airavata.mft.common.AuthToken authzToken = 2;
+}
+
+message HTTPSecretUpdateRequest {
+ HTTPSecret secret = 1;
+ org.apache.airavata.mft.common.AuthToken authzToken = 2;
+}
+
+message HTTPSecretUpdateResponse {
+ string secretId = 1;
+}
+
+message HTTPSecretDeleteRequest {
+ string secretId = 1;
+ org.apache.airavata.mft.common.AuthToken authzToken = 2;
+}
+
+message HTTPSecretDeleteResponse {
+ bool status = 1;
+}
\ No newline at end of file
diff --git a/services/secret-service/stub/src/main/proto/http/HttpSecretService.proto b/services/secret-service/stub/src/main/proto/http/HttpSecretService.proto
new file mode 100644
index 0000000..13a53db
--- /dev/null
+++ b/services/secret-service/stub/src/main/proto/http/HttpSecretService.proto
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+option java_multiple_files = true;
+package org.apache.airavata.mft.credential.service.http;
+
+import "http/HttpCredential.proto";
+
+service HTTPSecretService {
+ rpc getHTTPSecret (org.apache.airavata.mft.credential.stubs.http.HTTPSecretGetRequest) returns
+ (org.apache.airavata.mft.credential.stubs.http.HTTPSecret);
+
+ rpc createHTTPSecret (org.apache.airavata.mft.credential.stubs.http.HTTPSecretCreateRequest) returns
+ (org.apache.airavata.mft.credential.stubs.http.HTTPSecret);
+
+ rpc updateHTTPSecret (org.apache.airavata.mft.credential.stubs.http.HTTPSecretUpdateRequest) returns
+ (org.apache.airavata.mft.credential.stubs.http.HTTPSecretUpdateResponse);
+
+ rpc deleteHTTPSecret (org.apache.airavata.mft.credential.stubs.http.HTTPSecretDeleteRequest) returns
+ (org.apache.airavata.mft.credential.stubs.http.HTTPSecretDeleteResponse);
+}
\ No newline at end of file
diff --git a/standalone-service/src/main/resources/application.properties b/standalone-service/src/main/resources/application.properties
index 8d208ad..91e8595 100644
--- a/standalone-service/src/main/resources/application.properties
+++ b/standalone-service/src/main/resources/application.properties
@@ -1,4 +1,4 @@
-#
+ #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
diff --git a/transport/http-transport/pom.xml b/transport/http-transport/pom.xml
new file mode 100644
index 0000000..971d3c2
--- /dev/null
+++ b/transport/http-transport/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <artifactId>mft-transport</artifactId>
+ <groupId>org.apache.airavata</groupId>
+ <version>0.01-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>mft-http-transport</artifactId>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>mft-core</artifactId>
+ <version>0.01-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.5.14</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${maven.assembly.plugin}</version>
+ <executions>
+ <execution>
+ <id>mft-transport-build</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <tarLongFileMode>posix</tarLongFileMode>
+ <finalName>http-transport</finalName>
+ <descriptors>
+ <descriptor>src/main/assembly/transport-assembly.xml</descriptor>
+ </descriptors>
+ <attach>false</attach>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <echo>Moving Transport Plugin to plugins directory</echo>
+ <copy file="${basedir}/target/http-transport-bin.zip" tofile="${project.basedir}/../../plugins/http-transport-bin.zip"/>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/transport/http-transport/src/main/assembly/transport-assembly.xml b/transport/http-transport/src/main/assembly/transport-assembly.xml
new file mode 100644
index 0000000..5fca7da
--- /dev/null
+++ b/transport/http-transport/src/main/assembly/transport-assembly.xml
@@ -0,0 +1,53 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<!DOCTYPE assembly [
+ <!ELEMENT assembly (id|includeBaseDirectory|baseDirectory|formats|fileSets|dependencySets)*>
+ <!ELEMENT id (#PCDATA)>
+ <!ELEMENT includeBaseDirectory (#PCDATA)>
+ <!ELEMENT baseDirectory (#PCDATA)>
+ <!ELEMENT formats (format)*>
+ <!ELEMENT format (#PCDATA)>
+ <!ELEMENT fileSets (fileSet)*>
+ <!ELEMENT fileSet (directory|outputDirectory|fileMode|includes)*>
+ <!ELEMENT directory (#PCDATA)>
+ <!ELEMENT outputDirectory (#PCDATA)>
+ <!ELEMENT includes (include)*>
+ <!ELEMENT include (#PCDATA)>
+ <!ELEMENT dependencySets (dependencySet)*>
+ <!ELEMENT dependencySet (outputDirectory|outputFileNameMapping|includes)*>
+ ]>
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <dependencySets>
+ <dependencySet>
+ <useProjectArtifact>true</useProjectArtifact>
+ <outputDirectory>libs</outputDirectory>
+ <includes>
+ <include>*</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/transport/http-transport/src/main/java/org/apache/airavata/mft/trnasport/http/HttpIncomingStreamingConnector.java b/transport/http-transport/src/main/java/org/apache/airavata/mft/trnasport/http/HttpIncomingStreamingConnector.java
new file mode 100644
index 0000000..2aba197
--- /dev/null
+++ b/transport/http-transport/src/main/java/org/apache/airavata/mft/trnasport/http/HttpIncomingStreamingConnector.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.airavata.mft.trnasport.http;
+
+import org.apache.airavata.mft.core.api.ConnectorConfig;
+import org.apache.airavata.mft.core.api.IncomingStreamingConnector;
+import org.apache.airavata.mft.credential.stubs.http.HTTPSecret;
+import org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorage;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.http.HttpHeaders;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+public class HttpIncomingStreamingConnector implements IncomingStreamingConnector {
+ private static final Logger logger = LoggerFactory.getLogger(HttpIncomingStreamingConnector.class);
+
+ private CloseableHttpClient httpClient;
+ private HttpGet httpget;
+
+ private ConnectorConfig connectorConfig;
+ @Override
+ public void init(ConnectorConfig connectorConfig) throws Exception {
+ this.connectorConfig = connectorConfig;
+ HTTPStorage httpStorage = connectorConfig.getStorage().getHttp();
+ HTTPSecret httpSecret = connectorConfig.getSecret().getHttp();
+
+ httpget = new HttpGet(httpStorage.getBaseUrl().endsWith("/")?
+ httpStorage.getBaseUrl() + connectorConfig.getResourcePath() : httpStorage.getBaseUrl()
+ + "/" + connectorConfig.getResourcePath());
+
+ switch (httpSecret.getAuthCase()) {
+ case TOKEN:
+ String token = httpSecret.getToken().getAccessToken();
+ String authHeader = "Bearer " + token;
+ httpget.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
+ break;
+ case BASIC:
+ String auth = httpSecret.getBasic().getUserName() + ":" + httpSecret.getBasic().getPassword();
+ byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
+ authHeader = "Basic " + new String(encodedAuth);
+ httpget.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
+ break;
+ }
+
+ httpClient = HttpClientBuilder
+ .create().build();
+ }
+
+ @Override
+ public void complete() throws Exception {
+ if (httpClient != null) {
+ try {
+ httpClient.close();
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+ }
+
+ @Override
+ public void failed() throws Exception {
+ if (httpClient != null) {
+ try {
+ httpClient.close();
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+ }
+
+ @Override
+ public InputStream fetchInputStream() throws Exception {
+
+ CloseableHttpResponse httpResponse = httpClient.execute(httpget);
+ int statusCode = httpResponse.getStatusLine().getStatusCode();
+
+ if (statusCode == 200) {
+ return new BufferedInputStream(httpResponse.getEntity().getContent());
+ } else {
+ logger.error("Invalid status code was received {} for for transfer path {}", statusCode,
+ connectorConfig.getStorage().getHttp().getBaseUrl() + "/" + connectorConfig.getResourcePath());
+ throw new Exception("Invalid status code was received : " + statusCode);
+ }
+ }
+}
diff --git a/transport/http-transport/src/main/java/org/apache/airavata/mft/trnasport/http/HttpMetadataCollector.java b/transport/http-transport/src/main/java/org/apache/airavata/mft/trnasport/http/HttpMetadataCollector.java
new file mode 100644
index 0000000..18014a3
--- /dev/null
+++ b/transport/http-transport/src/main/java/org/apache/airavata/mft/trnasport/http/HttpMetadataCollector.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.airavata.mft.trnasport.http;
+
+import org.apache.airavata.mft.agent.stub.FileMetadata;
+import org.apache.airavata.mft.agent.stub.ResourceMetadata;
+import org.apache.airavata.mft.agent.stub.SecretWrapper;
+import org.apache.airavata.mft.agent.stub.StorageWrapper;
+import org.apache.airavata.mft.core.api.MetadataCollector;
+import org.apache.airavata.mft.credential.stubs.http.HTTPSecret;
+import org.apache.airavata.mft.resource.stubs.http.storage.HTTPStorage;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.http.HttpHeaders;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+
+import java.nio.charset.StandardCharsets;
+
+public class HttpMetadataCollector implements MetadataCollector {
+
+ private HTTPStorage httpStorage;
+ private HTTPSecret httpSecret;
+ @Override
+ public void init(StorageWrapper storage, SecretWrapper secret) {
+ httpStorage = storage.getHttp();
+ httpSecret = secret.getHttp();
+ }
+
+ @Override
+ public ResourceMetadata getResourceMetadata(String resourcePath, boolean recursiveSearch) throws Exception {
+ HttpGet httpget = new HttpGet(httpStorage.getBaseUrl().endsWith("/")?
+ httpStorage.getBaseUrl() + resourcePath : httpStorage.getBaseUrl()
+ + "/" + resourcePath);
+
+ switch (httpSecret.getAuthCase()) {
+ case TOKEN:
+ String token = httpSecret.getToken().getAccessToken();
+ String authHeader = "Bearer " + token;
+ httpget.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
+ break;
+ case BASIC:
+ String auth = httpSecret.getBasic().getUserName() + ":" + httpSecret.getBasic().getPassword();
+ byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
+ authHeader = "Basic " + new String(encodedAuth);
+ httpget.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
+ break;
+ }
+
+ try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
+ try (CloseableHttpResponse httpResponse = httpClient.execute(httpget)) {
+ int statusCode = httpResponse.getStatusLine().getStatusCode();
+ if (statusCode == 200) {
+ return ResourceMetadata.newBuilder().setFile(
+ FileMetadata.newBuilder()
+ .setResourcePath(resourcePath)
+ .setResourceSize(httpResponse.getEntity().getContentLength())
+ .setFriendlyName(resourcePath).build()).build();
+ } else {
+ throw new Exception("Status code came as " + statusCode + " for resource " + resourcePath);
+ }
+ }
+ }
+
+ }
+
+ @Override
+ public Boolean isAvailable(String resourcePath) throws Exception {
+ return true; // It is not usable to check if the path is available
+ }
+}
diff --git a/transport/pom.xml b/transport/pom.xml
index 4df6b25..55ee49b 100755
--- a/transport/pom.xml
+++ b/transport/pom.xml
@@ -43,5 +43,6 @@
<module>dropbox-transport</module>
<module>swift-transport</module>
<module>odata-transport</module>
+ <module>http-transport</module>
</modules>
</project>
\ No newline at end of file