airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-custos] 07/24: API to add SSH credentials
Date Fri, 11 Oct 2019 20:42:14 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git

commit e4021296257df31e5c8a56e8a7ab821f5800a10b
Author: Dimuthu Wannipurage <dimuthu.upeksha2@gmail.com>
AuthorDate: Tue Jul 9 02:12:13 2019 -0400

    API to add SSH credentials
---
 .../credential/api/controllers/SSHCredentialsController.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/controllers/SSHCredentialsController.java
b/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/controllers/SSHCredentialsController.java
index a6063e5..8250687 100644
--- a/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/controllers/SSHCredentialsController.java
+++ b/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/controllers/SSHCredentialsController.java
@@ -5,10 +5,7 @@ import org.apache.airavata.custos.vault.VaultManager;
 import org.apache.custos.credential.api.resources.SSHCredential;
 import org.dozer.DozerBeanMapper;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 @RestController
 public class SSHCredentialsController {
@@ -24,4 +21,11 @@ public class SSHCredentialsController {
         SSHCredentialEntity credentialEntity = vaultManager.getCredentialEntity(SSHCredentialEntity.class,
token, gateway);
         return mapper.map(credentialEntity, SSHCredential.class);
     }
+
+    @RequestMapping(value = "/ssh/{gateway}", method = RequestMethod.POST)
+    public String createSSHCredential(@RequestBody SSHCredential sshCredential, @PathVariable("gateway")
String gateway) throws Exception {
+        SSHCredentialEntity credentialEntity = mapper.map(sshCredential, SSHCredentialEntity.class);
+        String token = vaultManager.saveCredentialEntity(credentialEntity, gateway);
+        return token;
+    }
 }


Mime
View raw message